First node stays on top - delphi

I want the first node to stay on top and should not be affected during scroll. The first node will be like a column header(stays on top even scrolling). How can I do that?
This kind of behavior is something you can currently find in spreasheets:
Lock first column (Header.Columns[0].Options → coFixed)
Lock first row (?)
I'm trying to insert a picture for more explanation but I don't have 10 reputations. Sorry about that. Thanks in advance.

You can't as VirtualTree doesn't support such a behaviour. Besides, VT already has header support (include hoVisible to Header.Options to show it) why don't you use that? You can custom paint it (see OnHeaderDraw events) if you want it to look like ordinary node.

Related

How to change the order of items in the algebra view of geogebra?

I'm using GeoGebra Classic 5 and have a bigger project where I've encountered the problem that I can't find any way to change the order of elements in the list of the algebra view after the elements are created. Sure I could of course just delete the affected elements and create them in the right order but I'm sure there must be a better solution to such a simple problem.
Here you see what it looks like right now, and how I would like it to look
I've tried looking through the properties panel and all the navbar buttons but there seems to be no way to change the order of the list. The only thing I've found is the "sort by" setting that changes the order but doesn't let the user decide the order other than some predefined sortings. I also haven't been able to find anything about this on google or the geogebra documentation. Hope you can help

Stringlist sort progress bar

I have a TListBox that can have a very long stringlist when loaded so I have the operator initiate a Sort by clicking a button. Sometimes the sort can take close to a minute and the operator is left wondering what's happening.
Is there any way I can use a TProgressBar to show that something is happening? If so, how?
OR
Can I Grey (visually disabled) the screen at the start and then color back to white when the sort is completed? If so, how?
Thanks
I believe that your fundamental problem is that you are using a visual control as a container. Sorting the list inside the container will have terrible performance. Put 60,000 strings in a TStringList and you'll be able to sort them instantly.
Rather than holding the items in the visual control, you can operate it in virtual mode. That will be the most efficient way to operate.
If you make these changes then you won't need a progress bar.

Can you make a pivot scroll like a panorama?

Is it possible to achieve a panorama-like scrolling effect in the pivot? I mean instead of flying items in, scroll them in. Like when you use the panorama control and drag the item in view you can already see the next and previous items, but in the pivot you don't - the current item flies out and the next / prev one flies in.
Why am I trying to do this?
Well, as you probably know you can not programatically set the SelectedIndex on a panorama because Microsoft decided to make that property read-only. I have tried several things to fix that including extending the control and using behaviors - but I didn't succeed so I gave up.
Finally I gave up an chose to use the Pivot control instead and it works just fine, except for the scrolling part, where I'd like to have the scrolling effect from the panorama.
Why am I trying to achieve?
A current page overlay. You know, like in the Android applications screen where you can swipe trough a couple of pages and you can see at the bottom / top of your screen on which page you are on (this is the easy part) and also, when you click on one of those bubbles it scrolls to the corresponding page (that's the hard part - because you can't set the SelectedIndex on the Panorama control).
So, any ideas on how to achieve that scrolling effect in the Pivot control? or maybe got another idea on how to change the SelectedIndex on the Panorama? (changing DefaultItem is not a solution).
Thanks.
This sounds way off from the regular behavior of the Panorama/Pivot control so you might want to have a look at the source code and adapt it: http://phone.codeplex.com/
EDIT
In changeset 80787 the panorama control and the pivot control were removed. So to get the code you need to go back to a changeset from before Oct 29 2012.

Add gui components from bottom up instead of top down

Is it possible to add gui components to blackberry screen beginning from the bottom instead of the top ?
Thanks
A quick response would be no but let me explain why and suggest afew work arounds;
Screens don't actually handle the laying out of fields onto themselves, to do this they delcare a delegate manager which can be any type of manager, vertical, horizontal etc. The problem is all managers begin painting themselves from the top left. For a manager to paint fields starting from the bottom it would have to know exaclty where the bottom is located and add components up rather than down which goes against all the low level code inside the manager class. You can read more on managers in the BlackBerry API documentation.
You could still achieve an effect similar to this though by tweaking how you add fields and playing with field styles. For example consider this code:
add(new LabelField("field 1"));
add(new LabelField("field 2"));
This would give us the results;
field 1
field 2
because field 1 is drawn then field 2 below it. However if we were always to insert fields at the begining of our manager e.g. position 0 like so:
insert(new LabelField("field 1", FIELD_BOTTOM), 0);
insert(new LabelField("field 2", FIELD_BOTTOM), 0);
We would get the results;
field 2
field 1
Which is the results you'd expect from a screen described in your question.
I'm not really sure how you'd get the fields to paint to the bottom of a screen though, you could try researching the "position relative bottom" styles but I'm honestly unsure.
You are probably using a VerticalFieldManager, and the documentation on that says:
A vertical field manager lays out
fields top to bottom in a single
column.
So if you
manager.add(field1);
manager.add(field2);
manager.add(field3);
The order of the fields on the screen will be just that.
But you could do something like this:
Vector v = new Vector();
v.add(field1);
v.add(field2);
v.add(field3);
for(int i=v.size()-1;i>=0;i--) {
manager.add((Field)v.elementAt(i));
}
Sort of. You can use the Manager#insert(Field, int) method and always insert at the zero index. If you do this with a VerticalFieldManager, it would simulate a bottom-up adding of Fields to the Manager.
Some of the answers so far are to use Manager.insert(Field, int), and keep inserting at position 0. This will work, but the running time of the insert is linear in the number of elements already added to the manager. Meaning this solution will have an overall quadratic running time. Not a big deal if you're adding under 10 fields, but if you're planning on adding more than that, the insert overhead will be substantial.
If you can do the inserts top to bottom, by reordering the fields as Muger's solution suggests, the running time will be much improved.
Finally, you can write your own BottomUpVerticalFieldManager that does the layout the way you want. When you write your own manager, you can layout the fields in whatever way pleases you. In this case, it would be bottom to top. Writing your own manager may seem daunting, but it will give you considerable freedom in the future when trying to solve layout issues.

How to use TVirtualStringTree to display multi-line items and "expanded" select item?

I'm looking to create a look similar to the image below (which I know was done using TVirtualStringTree), but I haven't found any example code on how to accomplish this.
Anyone knows how I can have multi-line items like on the example below, and "expand" the select item to show more lines?
Please take a look at VT Demos\Advenced. In there you have a Multiline nodes demo which I guess might be the thing you are looking for.
Demos can be found here
Edit: The download page is here and the third item is the demos.
I guess you've got an answer, but I'll give you a couple hints for putting this into practice because it's been a little wonky for me. (At least in Delphi 7)
If you do a #13#10 for a new line make sure you've got a space after the the #10, otherwise you will not get a line break.
VirtualTree.MultiLine[node] := true will allow multi line, but not necessarily make it multiline.
Do VirtualTree.InvalidateNode(Node) then VirtualTree.Refresh the tree to get the new size for the node after you've changed the caption.

Resources