Lazarus

Programming => General => Topic started by: superc on October 03, 2022, 11:41:13 am

Title: [SOLVED] Moving on TVirtualstringTree with arrow
Post by: superc on October 03, 2022, 11:41:13 am
Hello,

I have a TVirtualstringtree, and when in click on a element of my TVST I populate another part of screen with some data, and I lose focus on Tree: I want intercept key UP and DOWN keys and move selected row of TVST to next or prior record:

to intercept the keys no problem, but how can I programmatically move the record of a TVST?

Thanks in advance.
Title: Re: Moving on TVirtualstringTree with arrow
Post by: Arioch on October 07, 2022, 08:04:21 pm
if (control).CanFocus then (control).SetFocus

However that seems to be wrong approach

the real problem is why do you remove a focus from VST when populating other controls? The error is there, the data pumpnig is "under surface" operaiton that shoul not be destorying the focus as was set by user.

Woudl be better if you find what is stealing the focus from VST and fix that error instead
Title: Re: Moving on TVirtualstringTree with arrow
Post by: superc on October 10, 2022, 03:17:35 pm
if (control).CanFocus then (control).SetFocus

However that seems to be wrong approach

the real program is why do you remove a focus from VST when populating other ocntrols? The error is there, the data pumpnig is "under surface" operaiton that shoul not be destorying the focus as was set by user.

Woudl be better if you find what is stealing the focus from VST and fix that error instead

Yes Arioch, you have right; I resolved problem in this way: I have managed state in form and reset focus on tree after click on node in particular state.
Title: Re: Moving on TVirtualstringTree with arrow
Post by: Arioch on October 10, 2022, 05:42:58 pm
Great!

No last brush would be if you could edit your top post and change the subject line. so it would start with "[SOLVED] " to mark it, so both experienced users would not spend their time on it, and novice users wknew they can look into the thread to find solution for similar problems.
TinyPortal © 2005-2018