How to add custom options menu when Right Click on edit tool - Livecode - livecode

I want to create object and I want to add custom options menu when Right Click on edit tool.
This image :
I want to add custom menu on top "Edit Script"
How do I do ?

Not sure what you really are asking. When you right-click on an object, the IDE throws up a menu because it invokes the command: revPopUpMenu. Try this, just put the command in a button script.
If you want to make this your own, without hacking the IDE menu, then why not use a normal click and show a pullDown menu instead. You can populate the menu items as you wish, including especially the ability to populate on the fly based on the object clicked on, or any other attributes that might be local to that object or event.
Craig Newman

Here's an example to add to the IDE's context menu - originally posted on the livecode forums. There's also an example stack you can download : http://forums.runrev.com/viewtopic.php?f=9&t=18613
# catch the IDE's context menu message
on revHookBuildObjectEditorContextMenu pMenuTarget, pMenuName, #pMenu, pModifiedMenu
# custom menu item
put "Custom Item" & "-" & LF before pMenu
pass revHookBuildObjectEditorContextMenu
end revHookBuildObjectEditorContextMenu
# catch the IDE's message when an item is selected from the context menu
function dispatchContextMenuPick pMenuName, pItem
switch word 1 to -1 of pItem
case "Custom Item"
answer "Custom Item Selected"
exit to top
break
end switch
pass dispatchContextMenuPick
end dispatchContextMenuPick
To get it to work, put the code above into a button then use;
insert the script of button "MyFrontScript" into front

Related

Disable or hide "View Library" menu item

When clicking the "File" menu from the Spotfire Webplayer, there is a menu item called "View Library", is it possible to disable the item or just hide it?
there is currently no way to disable this menu item.
in theory you could use the set-public-address command via the config command line interface and change the URL to some other location, but if that isn't a valid URL it could break things. attempt at your own risk and in a dev environment.

Linux whiptail or dialog with menu and input together

I want to use the 'whiptail' package to generate a menu box and input box simultaneously on screen. Is this possible? Or maybe with dialog? I can't find any example of this.
I want something like this:
Menu item 1
Menu item 2
menu item 3
if none of the above, type your own:
Inputbox:
The user could either select one of the entries from the menu or type in his own input. How do I do this?
(I did see the dialog 'inputmenu' widget, but with the Ok/rename/cancel, its a bit clunky.)
The --inputmenu option in dialog is the closest fit; anything more would require a custom application. Regarding the "Ok/rename/cancel", there is some flexibility (see manual page):
--nocancel
Suppress the "Cancel" button in checklist, inputbox and menu box
modes. A script can still test if the user pressed the ESC key
to cancel to quit.
--extra-label string
Override the label used for "Extra" buttons. Note: for input-menu widgets, this defaults to "Rename".

How to remove Help button from CommandBar Popup menu

I'm using the Application.CommandBars.Add method to create a custom PopUp menu.
I'm on a Mac with OS 10.8 and using Excel for Mac 2011.
I get a Help button at the top of menu that I didn't ask for. It does work, as in it launches the Help Center. I just don't want it on this right-click menu. None of the code examples or discussion threads that I have found by searching this and other sites mention anything about this. How does it get there and what I can do to remove it?
I can't get at it with an index to the controls, or by its name:
CommandBars(MyMenu).Controls(1).Delete ........... removes my first command button ("Button 1")
CommandBars(MyMenu).Controls(0).Delete ........... fails - subscript out of range (duh)
CommandBars(MyMenu).Controls("Help").Delete ... fails - invalid argument
And likewise with trying to make it ".Enabled = False" or ".Visible = False".
Is there a way to get at it with the "Id:=30010"?
Is there some argument or property to the CommandBars.Add or ShowPopup methods that will tell it, "Don't 'Help' me so much, thanks."?
The code is exactly what you find on the MSDN site example for Creating Popup Menus so I won't add that here.
I don't have enough reputation points to post the screen snapshot of what it looks like when displayed with a Right-Click event. There is a "Help" button at the top of the menu, a separator line, then the buttons I defined on the menu.

How to make a custom dialog in InstallShield?

I'm trying to understand InstallShield (2009)/InstallScript on the fly, because I'm modifying someone else's installation script.
One of the dialogs during the installation procedure previously had one textbox on it, asking for a SQL Server instance, assuming a certain database name. Now I've just completed an enhancement enabling you to choose any database name, not just the default, and I need to add a field to this dialog so the user can input the chosen DB name. Monkey see, monkey do, just make a new control and duplicate and adapt whatever functionality the form had for the first textbox - easy enough, right?
Umm... problem here. It seems that the "SdShowDlgEdit1" form is a generic thing that gets shipped with InstallShield, and is used all over, wherever you have a dialog that needs one textbox. Change that form, and it changes everywhere that it's called... so now I have a spurious 2nd textbox appearing all over my installation wherever there was a single text box before.
Oops. Undo changes, and change the reference to "SdShowDlgEdit2", which is - you guessed it - InstallShield's standard form for dialogs needing 2 textboxes. Now that would be great.... excepting that the previous developer got there before me and added a "browse" button to that form for a place where he needed the 2nd text box to contain a folder path. I don't want that "browse" button, and I can't delete it.
So I think, why don't I create a custom form of my own, and not get under anyone else's toes? So I clone the form, rename the new instance to "EnterDbDetails", delete the "Browse" button and make the form look just right.
Then I go back into the InstallScript to redirect to "EnterDbDetails" and discover that the EzDefineDialog function requires me to pass in the "Resource ID" of the form. Now what was it again... 12018... great... fill in all necessary details, compile, build, and give it a whirl. Looks lovely, all the right default values are filled into the two text boxes - but hey! Why is the browse button there? And why is the text on the labels not what I set?
Back to InstallScript, check the Resource ID - turns out that the original "SdShowDlgEdit2" also has a Resource ID of 12018. Well, that explains that nicely. Silly that InstallShield allows you to have two forms with the same ID, but whatever... So let's go back to my "EnterDbDetails" form and change the ID...
... but the Resource Identifier property is read-only! WTF?
So now I can't use any of the standard forms, and I can't use a custom form because it won't let me change the resource ID.
I am stumped. Can anyone please explain how you are supposed to do something like this, which really ought to be the simplest thing in the world?
Creating New Custom Dialogs in InstallScript and InstallScript MSI Projects
Quote from the site (2015 edition) :
To create a custom dialog, you need to perform the following general steps:
Use the New Dialog Wizard to add a new custom dialog to your project. For more information, see Using the New Dialog Wizard to Add a New Custom Dialog to an InstallScript or InstallScript MSI Project.
Add controls to the dialog. For more information, see Adding a Control to a Dialog in an InstallScript or InstallScript MSI Project.
Create a script function that loads the dialog into memory, displays it on the screen, handles the end user’s interaction with the dialog’s controls, and closes the dialog when the user is finished with it. For more information, see Using InstallScript to Implement Custom Dialogs.
To create a new dialog:
Open the Dialogs view. The Dialogs view is located in the User Interface section of the View List.
Right-click the All Dialogs explorer and then click New Dialog. The Dialog Wizard opens. Click Next to dismiss the Welcome panel.
In the Dialog Template panel, click Interior Wizard Panel, and select the Let me insert this dialog in a User Interface sequence check box.
In the User Interface panel, select Installation in the User Interface Sequence list. In the list of dialogs, select InstallWelcome. Based on these selections, InstallShield will insert your new dialog in sequence immediately following the InstallWelcome dialog.
In the Dialog Position and Condition panel, leave the default settings, and click Finish. Your new dialog appears in the Dialogs list.
Right-click the dialog and select Rename. Rename the dialog WelcomeBitmap.
Using the same technique, you can insert additional dialogs in your installation’s user interface.
In this step, you will modify the WelcomeBitmap dialog that you just created:
First, create a bitmap (using a program like Microsoft Paint) that measures 300 by 150.
Open the Dialogs view.
Expand the WelcomeBitmap dialog’s node. Click English (United States) to open the Dialog Editor.
Click the Dialog Bold Title text box at the top of the dialog. In the Text field, type Welcome Bitmap. This changes the dialog’s main title.
Click the Dialog Normal Description text box at the top of the dialog. In the Text field, type Displays my welcome bitmap. This changes the dialog’s description.
Click the Bitmap button on the Dialog Control toolbar and use the cursor to drag a box on the dialog. Set the Height to 150 and the Width to 300.
In the File field browse to the bitmap file that you created in step 1.
After rebuilding the project (by pressing F7) and running it (by pressing CTRL+F5), the Welcome Bitmap dialog will appear after the Install Welcome dialog.
You need to edit the ResourceID (to something unique) in the Dialog table which is found in the Direct Editor under Additional Tools section in the Installation Designer.
By custimizing standard InstallShield dialogs, like sdWelcome, sdFinish and sdFinishReboot you will be able to use the dialogs default script APIs with the performed customization's

QtDesigner: is it possible to assign top menu item handler?

In QtDesigner, if i have a pushbutton and want to add a handler for it all i need to do is to right-click this button and select "go to slot" - QtCreator will automatically add a code and connect signal to slot. But top menu items don't have a "go to slot" in right click menu O_O. Is it possible to add handler to top menu item in QtDesigner? Of course i can write a "conect" method manually at constructor, but it's much more easily to do a few clicks in QtDesigner itself -_-.
On every menu item added corresponding 'command' will be displayed at 'commands' QtDesigner window. Right-click command and select 'go to slot'.

Resources