-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Consider this scenario: You have a pop up window that has a button that performs some action. You want to confirm that the action should be done (like a delete). The MessageBox kills the pop up:
<?xml version="1.0" encoding="utf-8"?> <window> <toolbarbutton label="Pop" onClick="win1.doPopup()" /> <window visible="false" closable="true" id="win1" border="normal"> <caption label="Test" /> <label>Test</label> <button onClick="ask()" label="Close" /> </window> <zscript> void ask() { if (Messagebox.show("Are you sure you want to close this window?", "Close?", Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) == Messagebox.YES) { win1.detach(); } } </zscript> </window>
I could make my pop up an overlapped window, but this allows my code (not in example above) to create multiple windows. Is this a feature or a bug?
/Daryl
Hi Daryl,
i can confirm your issue. I'm not sure about bug or feature. Open a new popup is a good time to close all others..
But sometimes this is a limit - i.e. every popup/context inside a bandpopup close the bandpopup!
The Combobox (list) seems also a popup. I want to code an assistant. After the first bandpopup he should open the next combbox - this is mission impossible.
Here some code:
<vbox> <bandbox id="bd"> <bandpopup> <vbox> <hbox> Search <textbox /> </hbox> <listbox width="200px" onSelect="bd.value=self.selectedItem.label; bd.closeDropdown();combo.open()"> <listhead> <listheader label="Name" /> <listheader label="Description" /> </listhead> <listitem> <listcell label="John" /> <listcell label="CEO" /> </listitem> <listitem> <listcell label="Joe" /> <listcell label="Engineer" /> </listitem> <listitem> <listcell label="Mary" /> <listcell label="Supervisor" /> </listitem> </listbox> </vbox> </bandpopup> </bandbox> <hbox> <checkbox checked="false" onCheck="bd.autodrop = self.checked" label="auto drop popup when typing" /> <checkbox checked="true" onCheck="bd.buttonVisible = self.checked" label="button visible" /> </hbox> <button label="openTestV2" onClick="combo.open()"/> Combobox: <combobox id="combo"> <comboitem label="Simple and Rich" /> <comboitem label="Cool!" /> <comboitem label="Thumbs Up!" /> </combobox> </vbox>
While the combo.open() in the button works, the open inside the bandbox will be closed with the bandpopup.
I think there is need for more controll for the popup-close. However it can be difficult to find the right moment for the close. Maybe a new parameter like closeWhen (default: old logic) can help.
/Robert
Dary,
So what went wrong to stop you using overlapped windows?
Rob,
I did following to allow the open event to be called: I use EchoEvent under the Events class.
<vbox> <bandbox id="bd"> <bandpopup> <vbox> <hbox> Search <textbox /> </hbox> <listbox width="200px" onSelect='bd.value=self.selectedItem.label; bd.closeDropdown(); Events.echoEvent("open", combo, null);' > <listhead> <listheader label="Name" /> <listheader label="Description" /> </listhead> <listitem> <listcell label="John" /> <listcell label="CEO" /> </listitem> <listitem> <listcell label="Joe" /> <listcell label="Engineer" /> </listitem> <listitem> <listcell label="Mary" /> <listcell label="Supervisor" /> </listitem> </listbox> </vbox> </bandpopup> </bandbox> <hbox> <checkbox checked="false" onCheck="bd.autodrop = self.checked" label="auto drop popup when typing" /> <checkbox checked="true" onCheck="bd.buttonVisible = self.checked" label="button visible" /> </hbox> <button label="openTestV2" onClick="combo.open()"/> Combobox: <combobox id="combo"> <comboitem label="Simple and Rich" /> <comboitem label="Cool!" /> <comboitem label="Thumbs Up!" /> </combobox> </vbox>
Hope this helps.
Hi RobertLee,
first thanks for your work-a-round. That solves my problem.
>> So what went wrong to stop you using overlapped windows?
1. i like the automatic position from the popup's
2. Of course, most time there is work-a-round to avoid nested popup's. But it's seems that only one kind of popup could be open (without close the others). It seems that comboboxes, messageboxes, bandpopup, popup, tooltip are a kind of popup. So i.e. tooltip closes a bandpopup. Not really a big problem - but sometimes a limit. In my case: i have an bandboxpopup with small pictures to select productgroup. I've tried to use the tooltip as zoomwindow - but it closes my bandbox.
/Robert
RobertLee,
>>So what went wrong to stop you using overlapped windows?
As I stated, it allows multiple windows to be opened. Imagine a list of widgets, each with a button that opens a detail window. If an overlapped window is created, you could click on each item in the list and a new window would open when I only want one. This is largely an implementation issue as I don't keep a reference to the first window such that I could rebuild it instead of opening a new one. However, the behavior of the pop-up window I like is how I can click outside the window to close it. If I put Robert P's example inside my pop up window, the combobox pops up without closing the main popup window.
So I want Window.popUp() to close other pop up windows but I don't want Messagebox to close pop-up's.
/Daryl
Hello Dary,
I have the same problem :-(, did you find a solution?
Asked: 2009-01-02 16:19:32 +0800
Seen: 420 times
Last updated: Oct 22 '16