how to add a menuitem in ModelPanel ?
yes! interesingly I couldnot find a proper way to add my menu in ModelPanel. (each of four top,front,persp,side)
eg. I wantto add my menu after "Look at Selection MenuItem"
is it possible ?
I found that
$modelPanelShowMenus
is a string array which is Menu of "Show" for all four viewPorts. but cant dive deeper.
Yes it is possible. You will need to override the function global proc postModelEditorViewMenuCmd which lives in file createModelPanelMenu.mel. Copy the entire procedure to a mel file to your user scripts folder. Do not change the original mel file!
Then add your menu item definitions on the line that come after following line:
$itemName = `menuItem -label (uiRes("m_createModelPanelMenu.kLookAtSelection"))
-command ("{ string $camera = `modelEditor -q -camera "+$editor+"`;"+
"viewLookAt $camera;}")`;
Then in your userSetup.mel call the mel file inside a eval deferred call to override the default behavior. And your set to go.
Alternatively override the menu handler name in the panel itself. This allows you to chain the calls later.
Related
I have a problem with MenuSelect event in Tcl/Tk 8.6.11 (tried in Linux, Debian 10.7).
In fact, it doesn't fire at all for the main and tearoff-ed menus. Though working fine in Tcl/Tk 8.6.9, and even in 8.6.11 - only while menus are not tearoff-ed.
A test code:
package require Tk
proc ::somehandler {w wt} {
puts "Step [incr ::step]: $w / $wt, index=[$wt index active]"
}
set w [menu .m -tearoff 1]
$w add command -label {Item 1}
$w add command -label {Item 2}
bind $w <<MenuSelect>> [list ::somehandler $w %W]
pack [button .b -text "Click me" \
-command {tk_popup .m [winfo pointerx .] [winfo pointery .]}]
I tried the following (idiotic though) replacement:
event delete <<MenuSelect>>
event add <<MenuSelect>> <Motion>
bind $w <<MenuSelect>> [list ::somehandler $w %W]
... with the same results.
Seemingly, it's related to menu pathes dealt in Tk somewhat tricky, as seen in the above example.
I'm too lazy to change a standard code at switching from 8.6.9 to 8.6.11/12, 8.7 etc.
TIA for any hints.
This is probably related to the fact that menus use clones for tearoffs and the menubar. From the documentation:
When a menu is set as a menubar for a toplevel window, or when a menu
is torn off, a clone of the menu is made. This clone is a menu widget
in its own right, but it is a child of the original. Changes in the
configuration of the original are reflected in the clone. Additionally,
any cascades that are pointed to are also cloned so that menu traversal
will work right. Clones are destroyed when either the tearoff or
menubar goes away, or when the original menu is destroyed.
I can't remember how exactly clones are really named, but you don't normally interact with them directly; it's only with event handling that you ever really see them. (I've only ever had to deal with them when doing tooltips for menus.)
Normally, it's considered best to avoid using <<MenuSelect>> and instead just set a -command on the entries that can be selected (or to just set the model variables right for checkbutton and radiobutton entries). And avoid tearoffs entirely; they're a style of menu interaction that went out of fashion over 25 years ago.
For Tk 8.6.11+, bind Menu should be used instead of bind $w (for individual menu items). It adds some acrobatics to an event handler that should calculate what's a menu item to be dealt with.
I.e. we have something like:
bind Menu <<MenuSelect>> [list ::somehandler %W]
The %W wildcard is passed to ::somehandler as a "cloned" name, if the menu item is in a cloned menu.
And ::somehandler should calculate who is the %W in reality.
Csaba Nemethi advises to use a procedure like clonename (from utils.tcl of BWidget package). This procedure gets a clone name from a "normal" menu item's path.
Here is a bit modified version of it:
proc clonename {mnu} {
# Gets a clone name of a menu.
# mnu - the menu's path
# This procedure is borrowed from BWidget's utils.tcl.
set path [set menupath {}]
set found 0
foreach widget [lrange [split $mnu .] 1 end] {
if {$found || [winfo class "$path.$widget"] eq {Menu}} {
set found 1
append menupath # $widget
append path . $menupath
} else {
append menupath # $widget
append path . $widget
}
}
return $path
}
As an example of use, see test.tcl of:
http://chiselapp.com/user/aplsimple/repository/baltip/zip/trunk/baltip.zip
Thank you Donal and Csaba for your hints.
I am trying to remove the underline from the items in my list box when i select it. I tried giving the entire list box the "activestyle=None" but i learned that you need to use the "itemconfigure". What i am lost on is what i should be putting for index. I have my .insert index as 'end' and it works properly but when i do that for the item configure it says its out of range. Here is the code if anyone can assist me here.
taskList = Listbox(setBox, bg="#1B2834",fg="white")
taskList.configure(width=183,height=39, activestyle=None, fg="#4299E9", selectbackground="#061523",
selectforeground="#4299E9")
taskList.itemconfigure('end', activestyle=None)
taskList.insert('end', taskIDnum)
You don't use itemconfigure to set the activestyle attribute. You should use the configure method of the listbox. The documented value to turn off the ring around active item (or underline, depending on platform) is the string "none", not the python value None.
taskList.configure(activestyle="none")
is it possible to copy the current active layer name in Photoshop and use it as the file name for a 'Save As' command in a Photoshop action?
Export Layers to Files isn't suitable because I only want to save a single jpg at a particular point in the action, but because the action is recursive I need a way of changing the filename so that the resulting jpg isn't overwritten with each recursion.
Many thanks!
It's possible to get the name of the activeLayer and save it within an variable:
var layerName = app.activeDocument.activeLayer.name;
var destFile = new File ("~/Desktop/" + layerName + ".jpg");
If you want to document.saveAs() you should set the asCopy parameter to true:
app.activeDocument.saveAs (destFile, docExportOptions, true, Extension.LOWERCASE);
This will prevent a name change of the file you're working with.
Instead of document.saveAs() you could use document.exportDocument() in case you want a really small JPEG output.
app.activeDocument.exportDocument (destFile, ExportType.SAVEFORWEB, docExportOptions);
Have you tried : "Export layers to files..." in Files, Script ? You don't tell us which method you are using right now.
This should export each layer with their name + a custom prefix of your choice.
Also, you may want to take a look at the Insert Menu Item that lets you record a set of actions and then does it automatically. If you need something more complex than the first option, this might be your solution.
In the TI-BASIC programming language (Specifically TI-84+), how do you create input forms, such as the ones included in the default apps on the TI-84+.
The image included here shows an example of what I'm trying to create: A menu that you can scroll through and input multiple variables freely before executing a function
Additionally, is it possible to make this menu dynamically-updating as variables are entered?
You've set a rather tall order for TI-Basic to fill. user3932000 is correct; there is no built in function to create an input form of the type you request.
However, there is nothing stopping you from creating an interactive interface yourself. Creating it from scratch will be a time consuming and, it will consume a significant amount of memory on your calculator. There is no boilerplate code you plug your variables into to get the results you want, but you might have some luck modeling it after this quadratic solver I wrote.
ClrHome
a+bi
Output(1,1," QUADRATIC
Output(2,1," AX²+BX+C
Output(3,1,"ZEROS:
Output(6,1,"A=
Output(7,1,"B=
Output(8,1,"C=
DelVar YDelVar D
" →Str1
While Y≠105
getKey→Y
If Ans
Then
Output(X,4,Str1
Output(3,7,Str1+Str1+Str1+"
End
X+(Ans=34)-(Ans=25
If Ans<6:8
If Ans>8:6
Ans→X
Output(Ans,16,"◄
D(Y≠45→D
If Y=25 or Y=34
sum({A,B,C}(X={6,7,8→D
If Y=104:⁻D→D
10not(Y)+Y(102≠Y)-13int(Y/13(2>abs(5-abs(5-abs(Y-83
If Ans≤9
D10+Ans-2Ans(D<0→D
If X=6:D→A
If X=7:D→B
If X=8:D→C
If A
Then
2ˉ¹Aˉ¹(⁻B+{1,⁻1}√(B²-4AC
Else
If B
Then
⁻C/B
Else
If C
Then
"No Zeros
Else
"All Numbers
End
End
End
Output(3,7,Ans
Output(6,3,A
Output(7,3,B
Output(8,3,C
End
ClrHome
Ans
Here's a GIF of what it does for you.
With a little more work. This code could be used on the Graph screen instead of the home screen, giving more option in terms of layout and design.
In the TI-BASIC programming language (Specifically TI-84+), how do you create input forms, such as the ones included in the default apps on the TI-84+.
There are many ways to ask for input in your program:
Prompt: Asks for input and stores it in a variable. For example, Prompt A. Simplest way to ask for input, but not very visually appealing.
Input: Similar to the Prompt command, except that now you can include text within the input. For example, Input "What is your name?",A.
Menu(: Multiple choice input, and each choice is connected to a Lbl marker somewhere else in the script. Much like the error screen with the quit/goto choices that you've probably seen. For example, Menu("Are you a boy or a girl?","Boy",B,"Girl",G).
getKey: Checks if a certain key is pressed, and will output True (1) if that key is pressed. For example, getKey 105. See here for which numbers each key corresponds to.
The image included here shows an example of what I'm trying to create: A menu that you can scroll through and input multiple variables freely before executing a function http://imgur.com/ulthDRV
I'm afraid that's not possible in programs. You can either put in multiple inputs, or you might be interested in looking into making apps instead.
Additionally, is it possible to make this menu dynamically-updating as variables are entered?
If you're talking about the text on top of the screenshot, yes you can; just put a Disp command or something after each line of Input, so that it continuously overwrites the text above with new text after you input a variable.
I have created nsi file using NSIS plugin in eclipse.I have read the property file value using following code,
${ConfigWrite} "C:\resource\conf.properties" "WEBSERVICE.URL" $0
Now i want to create one text box and copy the value of "WEBSERVICE.URL" into that textbox.If the user enter the input in textbox then it should replace the value of WEBSERVICE.URL in config property file.else it will take default value.can anyone hele me?
You should look at the examples of nsDialogs.
Look in the Examples\nsDialogs directory of your NSIS installation : the InstallOptions.nsi script should help you.