I have an Popup(not modal window) which shows textbox, when I start typing in the textbox I need to open another popup which show listbox,when I select any item from list box the popup disappears as well the previous popup also disappears how can I avoid closing of the very first popup on close of 2nd popup.
Use a standard "bandpopup" component - in this case you wouldn't even have a second popup to manage. Other thing which comes to my mind is add onClose event listener or event handler - whichever you prefer - and stop event propagation with Event.stop(caughtEvent). It will effectively prevent propagation of OnClose event and your first popup wouldn't be closed.
Related
I'm developing custom system buttons - minimize, maximize and close window. It's working OK, but also I want to catch changing window state for Maximize / Restore down button. For example, when user double click on window title, window maximized and corresponding button should automatically repaint for "Restore down" state.
As I know, there is WM_SYSCOMMAND message for Form which notify for window state change. And we can get parent form for button (by GetParentForm()). So how to tie it all together? Or maybe you suggests something else?
Button inherits by TCustomControl.
I want to test a wicket component which shows a context menu on click with the secondary mouse button.
With WicketTester.click(Component) I can click obviously simulate a click on a component. But how do I simulate a click with the secondary mouse button?
WicketTester does not provide means to test JavaScript!
If the context menu is being shown with Wicket Ajax call to the server to make it visible then you can do tester.executeAjaxBehavior(...).
If the menu is shown via JavaScript in the browser then WicketTester cannot check whether it is visible or not. But in that case you should be able to test selecting a menu item, i.e. sending an Ajax call with the appropriate value for the item.
I've created a GtkComboBoxText using gtk_combo_box_text_new_with_entry. When I type into it, the "changed" callback is called for every letter.
How can I tell when the user has finished their entry?
I'd be happy to require the user to press 'Enter' at the end, but that doesn't call the callback.
(I'm using GTK+2.)
(Stackoverflow suggested another Q&A which put me on the path to enlightenment. I hadn't seen it while searching before I wrote my Q.)
It boils down to
g_signal_connect(gtk_bin_get_child(GTK_BIN(cb))/*entry*/, "activate", G_CALLBACK(entryActivated), NULL); where cb is the GtkComboBoxText (GtkWidget*). The callback is called when 'Enter' is pressed.
Pressing enter in a GtkComboBoxText that has an entry causes the child GtkEntry to emit the activate signal.
If the GtkComboBoxText contains an entry (via the 'has-entry' property), its contents can be retrieved using gtk_combo_box_text_get_active_text(). The entry itself can be accessed by calling gtk_bin_get_child() on the combo box.
https://developer.gnome.org/gtk2/stable/GtkEntry.html#GtkEntry-activate
The combo box might be considered as part of a form that has its own apply button.
You can also connect to GtkWidget signals. I can't say which event but there is one that is emitted when a widget loses keyboard focus to another widget in the same window. This would allow save on tab out. This is distinct from the window losing focus to another window which is a signal emitted on the GtkWindow. As the widget that has focus in the window does not change when a window loses focus.
I have a dialog box, which contains a button and a TabLayoutPanel. The button is outside the TabLayoutPanel. Tab contents are separate custom widgets.
The problem: I want to respond to clicks on the button by performing an action inside one of the tab content widgets.
I tried using the GWT EventBus this way:
fire an event upon button click
add handler for this event inside the tab
But here's the problem: if I close/open the tab multiple times, the event handler will be registered again. And when the button is clicked, the event handler will start multiple times (for every handler registration/however many times the tab was opened).
Since my dialog box doesn't have an activity/place, I cannot use GWT's Activity.start(... EventBus eventBus) for automatic activity deregistration.
A possible solution is to manually remember registered HandlerRegistration(s) and .removeHandler() them when I navigate away from the tab. But this is a rather ugly solution.
Question: Is there a way to unregister events in a dialog box without remembering them?
It's hard to give a concrete answer without code, but I'd do it like this:
Add ClickHandler to the button when the Popup/Dialog gets opened.
If this button is clicked, check which tab is the active one and call a specific method on the widget in that tab.
getSelectedIndex() and getWidget(index) should be the methods on the TabLayoutPanel to use to determine which widget is the active one.
Unregister the clickhandler after the Popup/Dialog got closed.
This way, you have only one Handler to remove what should be the normal way, e.g. with the onClose() event of the DialogBox.
I plan to add a menu that pop ups when a user performs a certain action. This menu will include some fields that the user will fill out and then hit "Submit" which will close the dialog box and update the client based on information inputed.
However, I want the user to be able to close the dialog window by hitting cancel or submit, and not by clicking on the screen outside of the dialog box.
How can i do this? Or maybe I should just use a PopupPanel?
It's as easy as setting the auto-hide behavior to false, either at construction time or later.