NGDesktop UI (ref)

(part of package 'NGDesktop UI')

You can access it in code via: plugins.ngdesktopui

Properties

API

addCheckBox

Add checkbox to the specified menu

@param {int} index - menu index @param {string} text - checkbox label @param {function} callback - callback function to call The callback function will receive: - text of the clicked item - type of the clicked item ("normal", "radio", "checkbox") - checked value for checkboxes and radio buttons, otherwise undefined @param {boolean} [checked] - checkbox initial status (unchecked by default) @param {int} [position] - insert position @param {int} [itemIndex] - submenu index; when specified the position is relative to this submenu @return {int} - the index of the added checkbox

Note: when add the checkbox to an existing menuitem, that menuitem will get from type "normal" to type "submenu". If previously a callback has been set, that callback will no longer be called

Parameters:

index int text string callback function checked boolean (optional) position int (optional) itemIndex int (optional)

Returns: int


addDevToolsMenu

Add Developer Tools menu to the menu bar

Use it just for debugging. Remove any call to this function once you're done.

@return {int} - the index of the added menu or -1 if nothing has changed


addMenu

Add new menu to the menu bar

@param {string} text - menu text @param {int} [index] - menu insert position (zero based) @return {int} - the index of the added menu

Parameters:

text string index int (optional)

Returns: int


addMenuItem

Add menu items to existing menu.

@param {int} index - menu index @param {string} text - menuitem text @param {function} callback - callback function to call The callback function will receive: - text of the clicked item - type of the clicked item ("normal", "radio", "checkbox") - checked value for checkboxes and radio buttons, otherwise undefined @param {int} [position] - insert position @param {int} [itemIndex] - submenu index; when specified the position is relative to this submenu @return {int} - the index of the added menu item

Note: when add an item to an existing menuitem, that menuitem will get from type "normal" to type "submenu". If previously a callback has been set, that callback will no longer be called

Parameters:

index int text string callback function position int (optional) itemIndex int (optional)

Returns: int


addRadioButton

Add radio button to the specified menu

@param {int} index - menu index @param {string} text - checkbox label @param {function} callback - callback function to call The callback function will receive: - text of the clicked item - type of the clicked item ("normal", "radio", "checkbox") - checked value for checkboxes and radio buttons, otherwise undefined @param {boolean} [selected] - initial selected status @param {int} [position] - insert position @param {int} [itemIndex] - submenu index; when specified the position is relative to this submenu @return {int} - the index of the added radio button

Note: when add the checkbox to an existing menuitem, that menuitem will get from type "normal" to type "submenu". If previously a callback has been set, that callback will no longer be called Note: For the first added radio button in a group, the radio button is selected regardless the selected param

Parameters:

index int text string callback function selected boolean (optional) position int (optional) itemIndex int (optional)

Returns: int


addRoleItem

Add a menuitem with standard native system behavior. For complete allowed value list: https://github.com/Servoy/ngdesktopui

@param {int} index - menu index @param {string} role - item role. @param {string} [text] - menuitem text; when not specified the System will provide a standard (localized) one @param {int} [position] - insert position; when role is a predefined menu, this parameter is ignored; @param {int} [itemIndex] - submenu index; when specified the position is relative to this submenu; when role is a predefined menu this parameter is ignored @return {int} - the index of the added role item

Parameters:

index int role string text string (optional) position int (optional) itemIndex int (optional)

Returns: int


addSeparator

Add separator line to the specified menu

@param {int} index - menu index @param {int} [position] - insert position @param {int} [itemIndex] - submenu index; when specified the position is relative to this submenu @return {int} - the index of the added separator

Parameters:

index int position int (optional) itemIndex int (optional)

Returns: int


closeBrowserView

Closes a and destroys a previously created BrowserView by the given id.

@param {int} id - the id of the view to close.

Parameters:

id int


createBrowserView

Creates a BrowserView (looks like an iframe) and adds this to the current window at the given coordinates with the given width and height. It returns and id that can be used to close/clean up this view later on, or to target that view to inject some javascript.

@param {int} x - the X coordinate to position this view @param {int} y - the Y coordinate to position this view @param {int} width - the width of this view @param {int} height - the height of this view @param {string} url - the url to load into this view @return {int} the id to target this view later on.

Parameters:

x int y int width int height int url string

Returns: int


createTrayMenu

Returns: trayMenu


getMenuCount

Count menus from the menu bar.

Returns: int


getMenuIndexByText

Return the menu text at the specified position.

@param (string) text - the text to query for @return {int} - menu index containing the specified text; if not found return -1

Parameters:

text string

Returns: int


getMenuItemIndexByText

Get menuitem index from the specified menu

@param {int} index - menu index @param {string} text - menuitem text to query for index

Parameters:

index int text string

Returns: int


getMenuItemText

Get menuitem text from the specified menu

@param {int} index - menu index @param {int} itemIndex - menuitem index to query for text

Parameters:

index int itemIndex int

Returns: string


getMenuItemsCount

Count menu items for the specified menu

@param {int} index - menu index @param (int) [itemIndex] - submenu index; when specified the submenu items will be count

Parameters:

index int itemIndex int (optional)

Returns: int


getMenuText

Return the menu text from the specified menu position.

@param {int} position to query for @return {string} - menu's text; if index is out of range - null is returned

Parameters:

index int

Returns: string


getWindowSize

Get window size

@return{int[]} - an array containing window's width and height

Returns: int[]


getZoomFactor

Get the zoom factor of the current window

@return {number} The zoom factor of the current window

Returns: double


hideWindow

Hide the window


injectJSIntoBrowserView

Injects the given javascript into the content of the BrowserView of the given id. The javascript can be a function declaration that is then called later on. The last statement return value is given back to the callback as a first argument. If something goes wrong then the callback is called where the first argument is null and a second argument has the message of the exception.

@sample // open google.com var id = plugins.ngdesktopui.createBrowserView(100,200,700,500,"https://www.google.com/"); // get the value of the search field and return this. plugins.ngdesktopui.injectJSIntoBrowserView(id, "function test() { return document.getElementsByName('q')[0].value};test();", callback);

@param {int} id - the id of the view to execute javascript in. @param {string} js - the piece of javascript that is injected into this view. @param {function} callback - the callback function that is used to get the results or exception if the call fails.

Parameters:

id int js string callback function


isFullScreen

Return true if window is in full screen state

@return{Boolean}

Returns: boolean


isMaximized

Return true if window is in maximized state

@return{Boolean}

Returns: boolean


isMinimized

Return true if window is in minimized state

@return{Boolean}

Returns: boolean


isNormal

Return true whether the window is in normal state (not maximized, not minimized, not in fullscreen mode)

@return{Boolean}

Returns: boolean


isVisible

Return true if window is in visible to the user

@return{Boolean}

Returns: boolean


maximizeWindow

Maximize the window


minimizeWindow

Minimize the window


registerOnCloseMethod

Register callback to be executed before closing ngdesktop

@param {function} callback - function to be executed before closing ngdesktop. Must return a boolean value: true: ngdesktop will close false: ngdesktop will not close @returns {boolean} - whether function executed succesfully or not

Parameters:

callback function

Returns: boolean


removeAllMenuItems

Cleanup the specified menu

@param {int} index - menu position @param {int} [itemIndex] - submenu index

Parameters:

index int itemIndex int (optional)


removeAllMenus

Cleanup the menubar. For MacOS that means to display a minimal menu


removeMenu

Delete menu from the specified position from the menu bar

@param {int} index - menu position to be deleted

Parameters:

index int


removeMenuItem

Remove menu item from existing menu.

@param {int} index - menu index @param {int} position - menuitem position to be removed @param {int} [itemIndex] - submenu index; when specified the position is relative to this submenu

Note: when the last item from a submenu it is removed that submenu will get from type "submenu" to type "normal". If previously a callback has been set for the item, that callback will be called further

Parameters:

index int position int itemIndex int (optional)


resetMenuToDefault

Reset ngdesktop menu to default


restoreWindow

Restore the window


setFullScreen

Set window to full screen mode

@param{boolean} - whether the window should be in fullscreen mode

Parameters:

flag boolean


setMenuBarVisibility

Show/hide menubar visibility. This function is working only on Windows/Linux

Parameters:

visible boolean


setWindowSize

Set window size to the specified dimensions

@param{int} - width (integer value greater than zero) @param{int} - height (integer value greater than zero)

Parameters:

width int height int


setZoomFactor

Set the zoom factor of the current window 1 == 100%. 0.5 == 50%.

@param {number} factor (values greater than 0.0 and smaller or equal to 5.0) @return {boolean}

Parameters:

factor double

Returns: boolean


showWindow

Show and gives focus to the window


unmaximizeWindow

Unmaximize the window


unregisterOnCloseMethod

Unregister the callback to be executed before closing ngdesktop.


Set the way external links will be handled from ngdesktop. WHen the flag parameter is set to: - true: open external links using OS default browser - false: open external links using a new ngdesktop window

@param {boolean}

Parameters:

flag boolean


Types

trayMenu

trayMenuItem

Last updated