Both sides previous revisionPrevious revision | Next revisionBoth sides next revision |
howtos:using_with_tcl_tk [2018/04/21 06:57] – typos etc. aplsimple | howtos:using_with_tcl_tk [2018/04/24 16:09] – E_MENU_PN, %B site.html (without quoting site.html) aplsimple |
---|
2. Unpack the below attached zip to save: | 2. Unpack the below attached zip to save: |
| |
emenu | e_menu |
menus directory | menus directory |
src directory | src directory |
3. Go to Geany's menu 'Edit/Settings', then to 'Tools' page and enter in the 'Context action' field: | 3. Go to Geany's menu 'Edit/Settings', then to 'Tools' page and enter in the 'Context action' field: |
| |
wish /home/me/UTILS/e_menu/emenu "s=%s" | wish /home/me/UTILS/e_menu/e_menu "s=%s" |
| |
Uff. Now you should be able to call the context help. While editing your [[http://www.tcl.tk|Tcl/Tk]] script, select a [[http://www.tcl.tk|Tcl/Tk]] command or simply place the caret on it and call "Context action" from popup menu. You should see something like: | Uff. Now you should be able to call the context help. While editing your [[http://www.tcl.tk|Tcl/Tk]] script, select a [[http://www.tcl.tk|Tcl/Tk]] command or simply place the caret on it and call "Context action" from popup menu. You should see something like: |
**// | **// |
| |
wish emenu [s=%s] [m=menufile] [options] | wish e_menu [s=%s] [m=menufile] [options] |
| |
//** | //** |
|// ah=list //|sets a list of hotkeys of autorun menu items of [HIDDEN] section to be run at start of [[using_with_tcl_tk|e_menu]]|ah=1,2,3| | |// ah=list //|sets a list of hotkeys of autorun menu items of [HIDDEN] section to be run at start of [[using_with_tcl_tk|e_menu]]|ah=1,2,3| |
|// "a2=Tcl command(s)" //|sets Tcl command(s) to be run at start of [[using_with_tcl_tk|e_menu]] __after__ processing //a=list// (see above)|"a2=d {Hello! \n\n Today is [clock format [set systime [clock seconds]] -format {%A %d-%m-%Y %H:%M}] \n\n Current dir: [pwd]}"| | |// "a2=Tcl command(s)" //|sets Tcl command(s) to be run at start of [[using_with_tcl_tk|e_menu]] __after__ processing //a=list// (see above)|"a2=d {Hello! \n\n Today is [clock format [set systime [clock seconds]] -format {%A %d-%m-%Y %H:%M}] \n\n Current dir: [pwd]}"| |
|// P=syms // |sets a symbol(s) used instead of "%" in the [[using_with_tcl_tk|e_menu]] call|It's important if the caller of [[using_with_tcl_tk|e_menu]] (Geany, shell) uses % literals conflicting with [[using_with_tcl_tk|e_menu]]'s parameters. \\ Example of overcoming Geany's %d substitution: \\ wish emenu "s=%s" P=# "t2=#A #d-#m-#Y #H:#M"| | |// P=syms // |sets a symbol(s) used instead of "%" in the [[using_with_tcl_tk|e_menu]] call|It's important if the caller of [[using_with_tcl_tk|e_menu]] (Geany, shell) uses % literals conflicting with [[using_with_tcl_tk|e_menu]]'s parameters. \\ Example of overcoming Geany's %d substitution: \\ wish e_menu "s=%s" P=# "t2=#A #d-#m-#Y #H:#M"| |
|// pa=number //|sets a pause (in milliseconds) to suspend [[using_with_tcl_tk|e_menu]] before starting it; sometimes it may be desirable|pa=500| | |// pa=number //|sets a pause (in milliseconds) to suspend [[using_with_tcl_tk|e_menu]] before starting it; sometimes it may be desirable|pa=500| |
|// "x*=string" //| e_menu wildcard %x* of commands|"x=%s" "x0=%s" "xz=%s"| | |// "x*=string" //| e_menu wildcard %x* of commands|"x=%s" "x0=%s" "xz=%s"| |
** 1. ** | ** 1. ** |
| |
wish /home/me/e_menu/emenu "s=%s" "m=menus/menu.mnu" \ | wish /home/me/e_menu/e_menu "s=%s" "m=menus/menu.mnu" \ |
"h=/home/me/DOC/Tcl/tcl8.6" c=1 fs=11 \ | "h=/home/me/DOC/Tcl/tcl8.6" c=1 fs=11 \ |
"PD=/home/me/PG/projects/e_menu" b=/usr/bin/epiphany a=6,b | "PD=/home/me/PG/projects/e_menu" b=/usr/bin/epiphany a=6,b |
cd $DIR | cd $DIR |
| |
wish ./emenu "s0=$PROJECT" "s1=$THEME" "s2=$SUBJ" "b=$BROWSER" "PD=$DIR" \ | wish ./e_menu "s0=$PROJECT" "s1=$THEME" "s2=$SUBJ" "b=$BROWSER" "PD=$DIR" \ |
m=menus/git.mnu g=$LEFT+30 t=1 o=0 w=21 fs=10 pa=100 & | m=menus/git.mnu g=$LEFT+30 t=1 o=0 w=21 fs=10 pa=100 & |
| |
wish ./emenu "b=$BROWSER" "PD=$DIR" \ | wish ./e_menu "b=$BROWSER" "PD=$DIR" \ |
m=menus/wiki.mnu g=$LEFT+465 t=1 o=0 w=21 fs=10 pa=100 & | m=menus/wiki.mnu g=$LEFT+465 t=1 o=0 w=21 fs=10 pa=100 & |
| |
wish ./emenu "b=$BROWSER" "PD=$DIR" \ | wish ./e_menu "b=$BROWSER" "PD=$DIR" \ |
m=menus/templates.mnu g=$LEFT+808 t=1 o=0 w=21 fs=10 pa=100 a=1 & | m=menus/templates.mnu g=$LEFT+808 t=1 o=0 w=21 fs=10 pa=100 a=1 & |
| |
* include the h= parameter into Geany context action: | * include the h= parameter into Geany context action: |
| |
wish C:\UTILS\e_menu\emenu "s=%s" h=C:\DOC\www.tcl.tk\man\tcl8.6 | wish C:\UTILS\e_menu\e_menu "s=%s" h=C:\DOC\www.tcl.tk\man\tcl8.6 |
| |
* download the [[http://www.tcl.tk|Tcl/Tk]] help to C:\DOC directory with commands: | * download the [[http://www.tcl.tk|Tcl/Tk]] help to C:\DOC directory with commands: |
After that include the menu file into the call string of Geany's context, for example: | After that include the menu file into the call string of Geany's context, for example: |
| |
wish C:\UTILS\e_menu\emenu "s=%s" h=C:\DOC\www.tcl.tk\man\tcl8.6 m=menus/test1.mnu | wish C:\UTILS\e_menu\e_menu "s=%s" h=C:\DOC\www.tcl.tk\man\tcl8.6 m=menus/test1.mnu |
| |
NOTE: if you dislike to have the HELP/EXEC/SHELL commands in your menu though the context would be desirable, you can use: | NOTE: if you dislike to have the HELP/EXEC/SHELL commands in your menu though the context would be desirable, you can use: |
For example, you can write Geany's context command as: | For example, you can write Geany's context command as: |
| |
wish C:\UTILS\e_menu\emenu "s0=%s" m=menus/test1.mnu | wish C:\UTILS\e_menu\e_menu "s0=%s" m=menus/test1.mnu |
| |
... and //test1.mnu// as: | ... and //test1.mnu// as: |
Let me remind you how [[using_with_tcl_tk|e_menu]] is called: | Let me remind you how [[using_with_tcl_tk|e_menu]] is called: |
| |
wish /home/me/UTILS/e_menu/emenu "s=%s" [options] | wish /home/me/UTILS/e_menu/e_menu "s=%s" [options] |
| |
The following call options of [[using_with_tcl_tk|e_menu]] can influence on menus' look and feel: | The following call options of [[using_with_tcl_tk|e_menu]] can influence on menus' look and feel: |
| |
cd %DIR% | cd %DIR% |
start wish %EMDIR%/emenu "m=menus/gitmenu.mnu" | start wish %EMDIR%/e_menu "m=menus/gitmenu.mnu" |
start wish %EMDIR%/emenu "m=menus/menu.mnu" | start wish %EMDIR%/e_menu "m=menus/menu.mnu" |
start cmd.exe /c "C:\Program Files (x86)\Geany\bin\geany.exe" readme.md wiki.txt e_help.tcl e_menu.tcl | start cmd.exe /c "C:\Program Files (x86)\Geany\bin\geany.exe" readme.md wiki.txt e_help.tcl e_menu.tcl |
| |
... and assuming that "Open all" entry is number 8 in menu.mnu, change its call so: | ... and assuming that "Open all" entry is number 8 in menu.mnu, change its call so: |
| |
start wish %EMDIR%/emenu "m=menus/menu.mnu" a=8 | start wish %EMDIR%/e_menu "m=menus/menu.mnu" a=8 |
| |
That's all. Minus a special start of Geany in batch file. Plus a useful menu command that allows __to restore your project file list__ in Geany IDE. | That's all. Minus a special start of Geany in batch file. Plus a useful menu command that allows __to restore your project file list__ in Geany IDE. |
| |
cd /home/me/PG/projects/my_best_project | cd /home/me/PG/projects/my_best_project |
wish /home/me/UTILS/emenu ... (run common menus) | wish /home/me/UTILS/e_menu ... (run common menus) |
geany ... (run Geany IDE) | geany ... (run Geany IDE) |
| |
So, you can have a lot of menus in "%PN" subdirectory of [[using_with_tcl_tk|e_menu]] that are specific for your current project and the one and only Geany context command for all projects like that: | So, you can have a lot of menus in "%PN" subdirectory of [[using_with_tcl_tk|e_menu]] that are specific for your current project and the one and only Geany context command for all projects like that: |
| |
wish /home/me/UTILS/emenu "s=%s" "m=%PN/main.mnu" ... | wish /home/me/UTILS/e_menu "s=%s" "m=%PN/main.mnu" ... |
| |
It would open the main menu of your current project as Geany's context command. | It would open the main menu of your current project as Geany's context command. |
| |
Also you can set in the calling string of [[using_with_tcl_tk|e_menu]] "PN=projectname" parameter that would override a value of %PN wildcard taken from a working directory. It may be suitable when your different projects are named equally (e.g. /.../Java/Project1 and /.../JavaScript/Project1). | Also you can set in the calling string of [[using_with_tcl_tk|e_menu]] "PN=projectname" parameter that would override a value of %PN wildcard taken from a working directory. It may be suitable when your different projects are named equally (e.g. /.../Java/Project1 and /.../JavaScript/Project1). |
| |
| The environment variable E_MENU_PN has the highest priority in setting the project name. E.g., in Linux you can call [[using_with_tcl_tk|e_menu]] this way: |
| |
| export E_MENU_PN=myproject |
| wish /home/me/UTILS/e_menu "s=%s" "m=%PN/main.mnu" ... |
| |
It would be convenient to have a batch of common menus that are not related to Geany's context and are called just before starting Geany IDE. Using g=+X+Y (geometry) and t=1 (stay on top) parameters you can dispose the common menus at left or right side of screen to have them at hand. And while coding in Geany IDE, you are free to use a project specific menu bound to Geany context command. | It would be convenient to have a batch of common menus that are not related to Geany's context and are called just before starting Geany IDE. Using g=+X+Y (geometry) and t=1 (stay on top) parameters you can dispose the common menus at left or right side of screen to have them at hand. And while coding in Geany IDE, you are free to use a project specific menu bound to Geany context command. |