1. Edita Menus - How?

Juergen Luethje kindly sent me a file (from TotalCommander) which
allows all the menus to be defined:

============================================
POPUP "&Files"
  MENUITEM "&Change Attributes...", cm_SetAttrib
  MENUITEM "&Pack...\tAlt+F5", cm_PackFiles
  MENUITEM "&Unpack...\tAlt+F9", cm_UnpackFiles
  MENUITEM "Test Arch&ive(s)\tAlt+Shift+F9",518
  MENUITEM SEPARATOR
 ...
END_POPUP

POPUP "&Commands"
  MENUITEM "CD &Tree...\tAlt+F10", cm_CDtree
  MENUITEM "&Search...\tAlt+F7", cm_searchfor
<snip>
============================================

This is not ***entirely*** dissimilar to eamenus.ew:

1/3):
integer
FileMenu,
	FileNew ,FileOpen,FileClos,FileSave,FileSvAs,
	FileExit,
EditMenu,
--	EditUndo,EditRedo,EditCut ,EditCuta,EditCopy,
<snip>

2/3):
FileMenu = menu("&File",Main)
	FileNew  = menuItem("&New\t(Ctrl N)")
	FileOpen = menuItem("&Open\t(Ctrl O)")
	...
EditMenu = menu("&Edit",Main)
--	EditUndo = menuItem("&Undo\t(Ctrl Z)")
<snip>

3/3):
function menuHandler(integer id, ...)
	if	  id = FileNew then 	newFile("",{""},{})
	elsif id = FileOpen then	void = openFile(0)	-- with dialogue
	elsif id = FileClos then	closeTab()
<snip>


Assuming I am to replace that,

QUESTION: How do I best tie entries to function? (!!!)
============================================
Creating menus, with the correct parents etc, is not really an issue.
However, once it gets "dynamic", it gets difficult to tie the text to
an absolute function cleanly, especially if you want to allow unused
entries to be removed (or preferably commented out). I don't really
want the hassle of "words" (eg cm_SetAttrib)...

Should I define a bunch of [ugh, global] constants, and use an
include file format, eg:

global constant cm_SetAttrib=1 -- [or nxtMenuID()]
			    ...
include user_defined_menus.inc:
	..
	{"&Change Attributes...", cm_SetAttrib},

	
OR, Should I /document/ absolutes, eg
	File Menu is 100,
	   New is 101,
	   Open is 102,
	   Save is 103,
	EditMenu is 200,

and hard-code these values throughout? (I'd actually use **local**
constants for legibility in this case) Fundamentally, I think this is
the better solution (assuming that say 109 can appear/be defined in
the text file between 102 and 103 without any difficulty), despite the
fact it doesn't quite "feel right". 


OR, is there a better answer?


In Anticipation,
Pete

new topic     » topic index » view message » categorize

2. Re: Edita Menus - How?

Hello again,

Pete, in a single sentence...what are you trying to accomplish with
the context menu? (besides think up items to add)


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

3. Re: Edita Menus - How?

On Tue, 08 Feb 2005 04:52:29 -0800, Al Getz <guest at RapidEuphoria.com>
wrote:

>Pete, in a single sentence...what are you trying to accomplish with
>the context menu? (besides think up items to add)

Get it right first time.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu