0

Popup closed by any other popup

asked 2009-01-02 16:19:32 +0800

dastultz gravatar image dastultz
797 8

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

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2016-10-22 11:12:19 +0800

maxspuls gravatar image maxspuls
1 2

updated 2016-10-22 11:20:48 +0800

Hello Dary,

I have the same problem :-(, did you find a solution?

link publish delete flag offensive edit

answered 2009-01-07 18:10:32 +0800

dastultz gravatar image dastultz
797 8

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

link publish delete flag offensive edit

answered 2009-01-07 01:56:42 +0800

robertpic71 gravatar image robertpic71
1275 1

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

link publish delete flag offensive edit

answered 2009-01-05 04:30:30 +0800

robertlee gravatar image robertlee
561

updated 2009-01-05 04:32:00 +0800

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.

link publish delete flag offensive edit

answered 2009-01-04 12:17:04 +0800

robertpic71 gravatar image robertpic71
1275 1

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

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-01-02 16:19:32 +0800

Seen: 416 times

Last updated: Oct 22 '16

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More