Setting the Panel Owner - apache-flex

I've got an application that allows a panel to popup to allow the user to edit some properties.
How do I set the panel owner so that it is on top of all the other components on the page without actually disabling them like you do with an alert box?

Use the PopUpManager to display something on top of everything else. I used a function like this to create the Popup before:
protected function createPopUp(className:Class):void{
var win : IFlexDisplayObject = PopUpManager.createPopUp(Application.application as DisplayObject, className, false) as IFlexDisplayObject;
PopUpManager.centerPopUp(win);
}
You can see it in action with the Flextras Calendar API Explorer. Click any button on the top bar.

Related

Custom popup in JavaFX

Is there any way to create a custom PopUp in JavaFX? I can't use tooltip, since I would like it to appear on double click, also I would like a different style than the standard tooltip.
My demands for the popup are:
1. If the user double click, show the popup
2. if the user clicks outside the popup, hide it
See this guide on all the different types of popups.
Use Popup.
Popup popup = new Popup();
// add content (you can add as many nodes as you want)
popup.getContent().add(new Label("Hello Popup!"));
// show (move this to the double-click listener)
popup.show(primaryStage);
// hide (move this to the click listener)
popup.hide();

Trouble with Flex 3 PopupManager

I'm trying to use the PopupManager class in a Flex3 AIR app to open different kinds of panels but I'm running into some problems with it. I'm using a method like the following with which all panels are opened ..
private function createPopUp(clazz:Class, modal:Boolean = false):IFlexDisplayObject
{
var p:IFlexDisplayObject = IFlexDisplayObject(PopUpManager.createPopUp(_windowParent, clazz, modal));
PopUpManager.centerPopUp(p);
return p;
}
_windowParent is a reference to the application's WindowedApplication root object. I'm running into two kinds of problems with this:
Not all popups appear modal, even if I set the modal parameter to true. This seems to happen if I open a popup panel from within another popup panel.
In some of the popup panels are ComboBoxes and the popdown menu of the comboboxes opens underneath of their parent panel (i.e. under the depth of the panel) so the menu of the combobox becomes partly or fully obstructed.
I've tried different parameters for the PopUpManager.createPopUp() childList parameter (e.g. PopUpManagerChildList.APPLICATION) but that did not change anything.
Hoping that anyone has some tips on these problems!
Nevermind! Figured out I some code that would change the depth of panels that was messing this up.

jQuery dialog serving multiple button's click event handller

I have a scenario where...
1.) Have created a div with a dropdown list and ok, cancel button
2.) On document ready - registering div created on step 1 into a jQuery dialog
3.) on a javascript button click - I am opening this dialog box.
4.) Now, the problem is - the jQuery dialogbox which I have created, needs to be used by other button clicks as well on same page. Now, my div's (which is a dialog at runtime using jQuery) ok button click is already engaged with a javascript function (button1 click) and I can not associate other button's click events with it - thus stuck up here and have no clues or hit to resolve this.
Anyone have faced this issue in asp.net, jquery earlier? Can someone provide a guidance?
Why you cant associate another event?
buttons will have different id. Is it?
$('#button1').click(function() {
alert('Handler for button 1 .click() called.');
});
$('#button2').click(function() {
alert('Handler for button 2 .click() called.');
});
Is this not possible in your case.?
Options:
1) disassociate the click handler when the function opens the div, then later in the function of opening the div associate a click handler to the button.
2) create multiple buttons toggle them all hidden, associate the click handler to each button you want. When the div is opened do a check to see which button to toggle to visible.
3) create no buttons but have a function create the button on the fly. When the div is opened, create the button for that div by calling the function and passing in a code telling it which button to open and what to associate to the click handler (this can be stored in an array and all that is passed in is the key).
Depending on the application, I have used all of these methods. The last one can have a twist that allows it to call an ajax server based application to get the button text and functionality (stored in a database), this saves you from having to load an array with button data, and also allows for easier expansion of the application.

Hide default options in right click context menu in flex

I'm developing a flex application and I want to add it a context menu. I got it with this code:
var myMenu:ContextMenu = new ContextMenu();
myMenu.hideBuiltInItems();
var defaultItems:ContextMenuBuiltInItems = myMenu.builtInItems;
defaultItems.print = false;
var item:ContextMenuItem = new ContextMenuItem("Go to google");
myMenu.customItems.push(item);
item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
this.contextMenu = myMenu;
But I have a problem. The menu shows four default options (Settings, about flash...) I would like to hide them. With defaultItems.print = false; I hid the print option, but I don't know how to hide others.
Does anybody know how to do that?
Thanks.
There is a technique to hide the Settings, about flash etc. from the context menu in Flash. The high level concept is to use JavaScript in the HTML container to disable the right-click on top of the SWF. Capture the event and then forward it to your Flex app using the ExternalInterface API which allows you to call Flex functions from JavaScript. Call a function defined in your Flex app to display a custom ContextMenu with only the menu items you want. This sidesteps the hardwired behavior in Flash/Flex where a right mouse click always causes a ContextMenu with the Settings, About stuff to come up.
A detailed walkthrough can be found at this link.
As the reference for ContextMenu says,
You cannot remove the Settings menu
item from the context menu. The
Settings menu item is required in
Flash so that users can access the
settings that affect privacy and
storage on their computers. You also
cannot remove the About menu item,
which is required so that users can
find out what version of Flash Player
they are using.
So you'll just have to live with the Settings and About items. For other default items, see the reference for ContextMenuBuiltInItems.

Popup flex window

When I click the button, it should popup my module, when i click outside it will hide or remove it. This is the code I have:
private var Showup:IFlexDisplayObject;
Showup = PopUpManager.createPopUp(this, samplemodule, false);
Showup.addEventListener(FlexMouseEvent.MOUSE_DOWN_OUTSIDE, Removewindow);
private function Removewindow(e:FlexMouseEvent):void
{
PopUpManager.removePopUp(Showup);
}
My problem is, in samplemodule I have lot of buttons. When I click any button the corresponding module should load to middle portion.. but it does not load.
Please tell me the mistake or an alternative option!
Please add
mouseDownOutside="PopUpManager.removePopUp(this)"
tag inside you samplemodule (Popping canvas) main Display object as tag.
This will remove the popup when you are moving outside the popup and clicking.
Not quite sure what you are having trouble with, the close or the centering of the popup. I think it is the centering. If so, try adding:
PopUpManager.centerPopUp(Showup);

Resources