Positioning window like popup control.
-
Hi, I have logic to show window when mouse is over listbox item (something like hover window). I would like to position this window same like popup control would position. Eg. i want to show this window exactly left to the listbox and if there is no enough space on screen, would like to position to other side where space is available. Thanks.
-
Hi, I have logic to show window when mouse is over listbox item (something like hover window). I would like to position this window same like popup control would position. Eg. i want to show this window exactly left to the listbox and if there is no enough space on screen, would like to position to other side where space is available. Thanks.
Simple enough... Call PointToScreen() on the listbox to get the coordinates relative to the screen, and position the window like that. Something like this (Pseudocode): pt = listbox.PointToScreen Left = pt.X - ActualWidth Top = pt.Y if (Left < 0) Left = pt.X + listbox.ActualWidth
Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)
-
Simple enough... Call PointToScreen() on the listbox to get the coordinates relative to the screen, and position the window like that. Something like this (Pseudocode): pt = listbox.PointToScreen Left = pt.X - ActualWidth Top = pt.Y if (Left < 0) Left = pt.X + listbox.ActualWidth
Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)
Thanks, that worked. But if i set the position before calling Show() method , it has no effect on position. And if set position after Show() widow flickers (moves position). How to avoid flickering? Thanks
-
Thanks, that worked. But if i set the position before calling Show() method , it has no effect on position. And if set position after Show() widow flickers (moves position). How to avoid flickering? Thanks
Set the window startup position to manual... Otherwise it'll try to position itself automatically.
Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)
-
Set the window startup position to manual... Otherwise it'll try to position itself automatically.
Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)
No Luck, still flickering.
-
No Luck, still flickering.
Set it to manual, position it, then call show. It won't flicker.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.