Popup window suddenly dissapears Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Eye
In need of some credit
In need of some credit
Posts: 4
Joined: Sat Jul 28, 2007 4:58 pm

Popup window suddenly dissapears

Post by Eye »

Hello,

I would like to create a popup window. I am using the wxPopupTransientWindow class. All is ok to show and hide the popup.

Inside my popup there is a wxListCtrl and I cannot select any element. Moreover, when I use the arrow keys, the popup disappear.

What is wrong ? I am using the 'popup' sample and add a wxListCtrl.

Thx.

edited by admin: Elaborated the title a bit more
loptr
Earned some good credits
Earned some good credits
Posts: 110
Joined: Tue Jan 23, 2007 12:22 pm
Location: Kiel, Germany
Contact:

Post by loptr »

maybe you're better off with a custom wxDialog...

try to create a wxDialog an add your listControl (don't forget ok and cancel buttons if you need them). everything should work fine then...

a more detailed answer would require more detailed information (what is your listControl for etc...)
OS: Win XP PRO SP2 (fully updated)
proc: INTEL Core 2 Duo E6400
wx: wxDevCpp (always latest stable)
Eye
In need of some credit
In need of some credit
Posts: 4
Joined: Sat Jul 28, 2007 4:58 pm

Post by Eye »

Hello,

Thank you for replying.
Yes, I am using a wxDialog because I cannot use the wxPopupTransientWindow to create Popup with a wxListCtrl.

But now, what I would like, is to emulate a popup. I do not want to add "Ok" and "Cancel" button.

So how can I capture the mouse event outsite the dialog but inside the parent (using a "Connect" does not work since the children does not skip the event to the parent) ?

Thx.
loptr
Earned some good credits
Earned some good credits
Posts: 110
Joined: Tue Jan 23, 2007 12:22 pm
Location: Kiel, Germany
Contact:

Post by loptr »

hmm, sounds kinda complicated.

first thought would be to

1. use wxSystemSettings::GetMetric to determine the screen size
2. do a collision detection in EVT_LEFT_UP
3. if outside the dialog but inside the screen (well, it must be inside the screen area, but as dialog's position may vary, i think it might be best to calculate...) throw a Close()

well, just a first thought, might be worth a try...


here comes a second one:
maybe it would be possible to write some OnLoseFocus() function or so; the dialog is derived from wxWindow, so this could be possible. dialogs "freeze" the app normally, though, so it might be better to use a wxFrame, because you can have have multiple parallel wxFrames (and only one of those can have the focus). so if your "popup"-frame loses focus, just Close() it...


but perhaps i'm totally wrong here and it is much easier to derive from the "wxPopup" (you know what i mean) or do it in a completely other way..
OS: Win XP PRO SP2 (fully updated)
proc: INTEL Core 2 Duo E6400
wx: wxDevCpp (always latest stable)
Eye
In need of some credit
In need of some credit
Posts: 4
Joined: Sat Jul 28, 2007 4:58 pm

Post by Eye »

Thank you for your idea...
Bye
Post Reply