Recent

Author Topic: [SOLVED] Moving on TVirtualstringTree with arrow  (Read 412 times)

superc

  • Full Member
  • ***
  • Posts: 197
[SOLVED] Moving on TVirtualstringTree with arrow
« 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.
« Last Edit: October 10, 2022, 06:27:34 pm by superc »

Arioch

  • Sr. Member
  • ****
  • Posts: 414
Re: Moving on TVirtualstringTree with arrow
« Reply #1 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
« Last Edit: October 10, 2022, 05:41:23 pm by Arioch »

superc

  • Full Member
  • ***
  • Posts: 197
Re: Moving on TVirtualstringTree with arrow
« Reply #2 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.

Arioch

  • Sr. Member
  • ****
  • Posts: 414
Re: Moving on TVirtualstringTree with arrow
« Reply #3 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