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.
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 want to make a menu that will take an undetermined quantity of labels and spread them out horizontally so that 3 are visible on screen at once. When pressing left/right it will go to the next one, the one that is selected is always in the center of the screen horizontally with the other two on the left/right of the screen.
The problem is that I also want a smooth transition not just a replacement. They need to wrap endlessly.
Not sure where to begin, not finding examples on google.
The concept you are talking about was popularized by Apple under the name "Cover Flow".
There is a widget like that available under a permissive license here: https://code.google.com/p/pictureflow/
I take it you want something a bit simpler (only show three labels, less fancy 3D effect), but I assume this is a good starting point.
Another one is the PathView QML element:
http://qt-project.org/doc/qt-5/qml-qtquick-pathview.html#details
It is even closer to what you like to do, feature-wise. It is also available in Qt4 and there is a tutorial here: http://qt-project.org/doc/qt-4.8/declarative-modelviews-pathview.html
I'm making my own UI from scratch using OpenGL that is why I'm asking this and please don't make any discouragement as this is just a hobby project.
Currently, I'm stuck implementing how this scrollbars really work. In my current implementation, the content scrolls at the wrong step value as well as the thumb, meaning, I set the value manually like 1px step for each of them.
The structure of my scrollbar implementation is describe as follows:
I draw scrollbars i.e the main rectangle where the 3 button lies.
Those 3 buttons are, thumb, buttonBack and buttonNext.
All of them do the basic logic of scrollbars i.e when I click each one of them, they moved. But the whole part(scrollbar) don't know how to scroll contents
So what I did is: I make another object and I call it scrollarea
It has two scrollbars, vertical and horizontal scrollbar.
I made a function called scrollToX and scrollToY which
does what I named to them.
But the step values I set to them are
manually set up.
I try to google some scrollbar, scrollarea, scrollview or whatever you call to that scrollable rectangle thing, but all I see are implementation and I cannot find any guides how to build your own. I have no choice but to look at their implementation. I try my best to comprehend what they did but their implementation of how their whole UI structure is very different to mine, and I cannot find anything useful there.
So I ask again here if anybody can explain me well how to make a properly functional scrollbar.
Most specific things I'm really concerned of are:
How do I determine the thumb step value?
How do I determine the content step value?
All of these depend on your content -
Is it just an image ? If so, you only need to change the offset depending on the size of the image.
Is it a list of values like in Windows explorer ? Then you need to create a data structure first that contains all of it, and shows the content that fits within the window as it scrolls.
OpenGL does not fit into this discussion.
folks!
I use a listview (Icon mode) to display items which consist of an image and a label.
As you can see in the shots the row height is variable on y depending on the label length. The problem is that I want the complete labels to be drawn, but they are automatically shrinked into two lines:
The strange thing about it is that once you select an item the whole label will be shown:
This is also the case when deselecting the item, but when another item gets selected, only that one will be shown completely.
Is there a way (without drawing the text manually) to avoid truncation in my case?
If some code is needed to answer this question, don't hesitate to ask.
Greetings,
Satara
I'm guessing this was a design choice: make things look less cluttered. E.g. picture your desktop with all labels shown completely... will look messy in my case.
However, you can fix this by drawing the label yourself. Have a look into custom draw which is a service provided by the list control. The thing is that it's usually an all or nothing approach, so this will likely require you to draw everything yourself: border, image, label, etc. The other option is to get hacky: subclass the window and draw the labels again after Windows did in response to several messages (unfortunately Windows does not restrict the painting to WM_PAINT, an optimization that is a left-over from the old days...)
I write software for the disabled. One of the problems is difficulty tracking the mouse pointer. I want to have the mouse cursor glow (or similar effect. Maybe water like ripples around it) when the user needs to locate it. How is this done? I know it's possible because it's used in a variety of software.
You can create custom animated cursors "on the fly" by using CreateIconFromResource and painstakingly creating the cursor data structures yourself. I recently added some tests to the Wine project for creating cursors in this way, you can take a look at the structure of the cursor data by looking at this example for a three-frame cursor:
http://source.winehq.org/source/dlls/user32/tests/cursoricon.c?v=wine-1.3.16#L222
Have a look at Realworld Cursor Editor found here.
Edit: As the OP pointed out, the OP was looking for a way of creating an animated cursor programmatically, using Win32API. AFAIK it cannot be done or is long-winded way of doing it, the 'LoadCursor' function can load the cursor from an embedded resource or a file on disk with an extension .ani, hence my answer in support for the usage of Realworld Cursor Editor which can create an .ani file containing animated cursors, the other way of doing it is to use the 'Control Panel' > 'Mouse', click on 'Pointers' tab-page on the dialog itself to set it as system-wide settings. Here is a sample of how an animated cursor gets loaded here.
Hope this helps,
Best regards,
Tom.
An alternative approach is to leave the cursor as-is, and instead add some effects around it, using, for example, a temporary topmost layered window that you draw some animation on. (eg. alpha-blended circles to get a glow effect around the cursor position.)
This has the advantage of leaving the cursor unchanged, so if it's conveying information (eg. hourglass or size handle), you're not interfering with that.
If all you need to do is make ripples appear around the cursor, there is a setting you can change in the mouse section of control panel such that ripples appear around the cursor when the CTRL key is pressed.