Jump to content


Photo

SetFocus problem


  • Please log in to reply
3 replies to this topic

#1 bosjo

bosjo
  • Members
  • 75 posts
  • Gender:Male
  • Location:Märsta, Sweden

Posted 06 May 2021 - 02:16 PM

I have a NextGrid6 which I use for selection; when the user doubleclick on a row/slide (currently a slide) I select the object belonging to that row/slide, and prepare the form for showing that object. But when I make the selection grid invisible (actually, Visible := false is OK; the attempt to set focus appears after the doubleclick handler exits), I get an "unable to set focus" error. I assume I am doing something really stupid, but how is one supposed to perform this type of operation?



#2 bosjo

bosjo
  • Members
  • 75 posts
  • Gender:Male
  • Location:Märsta, Sweden

Posted 07 May 2021 - 11:36 AM

The workaround I used to solve this problem, if anyone is interested, is to set a flag in the doubleclick handler, and do the actual "Visible := false" thingy in a action update. Not particularly beautiful, but it works...



#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 07 May 2021 - 12:14 PM

Hi bosjo,

 

Please sorry for short delay.

 

I will try to inspect/detect whether grid is still visible. If I correctly understood, you are setting Visible to False after user double click on a row inside grid?


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#4 bosjo

bosjo
  • Members
  • 75 posts
  • Gender:Male
  • Location:Märsta, Sweden

Posted 07 May 2021 - 12:36 PM

If I correctly understood, you are setting Visible to False after user double click on a row inside grid?

Precisely; I write a handler for a doubleclick event in a TNextGrid6, and in that I set Visible := false (after I extract the proper object from the grid and prepared the form for using it) on the grid. After the handler exits, the grid obviously tries to set focus, which doesn't work as it is not Visible anymore.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users