I am trying to make a Gtkmm::Entry bigger both vertically and horizontally so that in the end it would match the shape of a square. I wasn't able to find any documentation on this and would really appreciate if someone could help.
I have seen that it is possible to use the set size request method to give it a square shape however it is too small and the text written in it is illegible. Does anyone know how to achieve this?
You could use a GtkTextView which supports resizing. TextEntries are typically not re-sizable.
Related
I'm pretty sure there is a easy way to do this… but I'm not so proficient with GTK3 (coding in C/C++) at this moment, and i'm finding myself stuck looking how can I create a new GtkSpinButton having the "+" and "-" buttons upper and below the entry text box instead as they are shown by default (at the right side of text entry).
I looked around in the documentation and a bunch of websites without look, but I see that there are spinbutton.horizontal and spinButton.vertical CSS classes… so I think there should be a way to simply instantiate the widget programmatically in vertical mode instead of horizontal.
Any help/hints on this, please?
Well… after a bit more research, I did find/learn about the GtkOrientable interface and GtkSpinButton being one of the widgets implementing this, so gtk_orientable_set_orientation() did the trick!
I often use a TPanel or TGroupBox to group my form controls.
Now I need to draw just a straight line like the border of a Panel or GroupBox.
How do I do this on LAZARUS?
Thanks in advance!
Note: The technique must work on both Linux and Windows
As an optical line separator you should use either the TBevel component with Shape property set to one of the following values bsTopLine, bsBottomLine, bsLeftLine or bsRightLine depending on which line you currently need and resize it to a smaller size (in your case you can use bsTopLine or bsBottomLine and resize the bevel vertically):
Or you can use a special component called TDividerBevel which except the single line adds to this optical divider also a caption:
Here's what I've finally done but I'm not sure if this is the RIGHT way so I won't accept my answer. If there's someone else who can point out any issues with this, please let me know. I found this pretty straightforward as well :)
Place a TGroupBox on the form.
Leave the Caption property blank. Now it should look like a panel with only borders.
Use the mouse and drag the bottom border towards the top. Now it looks like a line.
Well, I personally think this method is NOT efficient as it would take up more memory space than just a real straight line. Anyway, so far it seems to work for me :)
Here's the screenshot - look towards the bottom (just above the last text box). The only issues is that on the sides of the line, it shows the lines bending. I think I should set the properties correctly than dragging with the mouse.
I have a styled QScrollBar on my table which uses an image for the handle of the scroll bar. The handle is rounded at the edges (with transparency in the image around the edges, of course). Now the problem is that i can't seem to make it re-size nicely.
It's a vertical scroll-bar, so the only way I found to work so far is to set:
background-image: url(:/res/img/scrollbar-vhandle.png);
background-repeat: repeat-y;
in my stylesheet. Which does what it's supposed to, only my scroll bar looks ugly, especially because of the rounded corners.
The image could be 'stretched' nicely by repeating a 1px high line from it's y-center. But even y-stretching should be ok. I just can't find a good way to do it.
Something like a QPushButton, where 9 images can be used for 1 button in order to scale would work, but unfortunately doesn't seem like it does.
So, if anyone can let me know if it's a way to do it through stylesheets (or deriving from QScrollBar, and repainting the handle) i'd appreciate it very much.
If you need more info, please let me know.
Well, as you say, you could inherit from the scrollbar and overload the paintEvent function. Therein you can pretty much to whatever you want, for example compute your new pixmap by repeating that one line and painting it. There are actually a couple of functions in QPixmap that should make this relatively easy.
I'm thinking like text fade in and slide effects. I imagine implementing this would be rather trivial and plan to do so myself, but wanted to make sure I'm not reinventing the wheel first. If it doesn't exist then I'm looking on advice on the best way to implement these.
The 2 things I'm looking to do are fade in text and have the window slide down when resizing, eg if I show a label that was previously hidden it would slide down ~20 pixels instead of just instantly growing 20 pixels larger.
The way I was thinking to implement the first one is, assuming it's possible, get the window/bg color and start it at that and transition it to the font color, if there's alpha channel support that would be even simpler to do (I'm not sure if there is since I haven't messed with colors yet). To do this I'd just choose a transition time period and process it with a for loop or something once the color increments have been determined.
Similarly to do the window transitions I would get the height of the change (not sure how to do that yet), determine the increments of change based on the transition time and in a for loop gradually adjust the size. Sorry if I didn't explain those very clear, I'm trying to get this in before I go to work and figure most of you will know what I'm trying to explain. As always thanks for the help!
For window resize transition effect, QPropertyAnimation may be the easiest to do since height is a widget property. Fading text might work the same way if the foreground color can be coerced into a property.
I am working on a game which would take touch gestures as inputs. Now, i would like to display the path/gesture as the user draws it. Can someone please tell me how to do this in cocos2d?
I tried to override the draw method and used ccDrawPoint(). But the point just keeps following the touch. I guess this is because the previous drawing is getting overwritten.
Can you tell me where i am going wrong here or suggest a better way to implement this?
i found a solution with CCRenderTexture sample test in cocos2d. Though i could not find enough documentation on it, but the sample code is enough for a start.