1. win32lib Q: Can a MenuItem be changed?

------ EXAMPLE
constant
MyMenu = create( Menu, "List of Items", Win, 0, 0, 0, 0, 0 ),
  Menu_item = create(MenuItem,"Baba Yaga the Witch",MyMenu,0,0,0,0,0)

setText(Menu_item,"Santa Claus")  -- This doesn't work.

setCaption(Menu_item,"Santa Claus")  -- This doesn't work.

------ END OF EXAMPLE

Can a MenuItem be changed?  If so, how in win32lib?


       Jerry Story

new topic     » topic index » view message » categorize

2. Re: win32lib Q: Can a MenuItem be changed?

jstory at freenet.edmonton.ab.ca wrote:

>
> Can a MenuItem be changed?  If so, how in win32lib?
>
>        Jerry Story
>
>

Will it work if you set it as type object instead of constant?

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

3. Re: win32lib Q: Can a MenuItem be changed?

jstory at freenet.edmonton.ab.ca wrote:

>
> Can a MenuItem be changed?  If so, how in win32lib?
>

It should be possible using a call to w32Func(xModifyMenu, ...). I'll play
around with it and let you
know.
---------
Derek.

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

4. Re: win32lib Q: Can a MenuItem be changed?

I've got an example here which may help you...

-------------
include win32lib.ew
without warning

constant
Win = create(Window, "test", 0, 0, 0, 500, 500, 0),
MyMenu1 = create( Menu, "List of Male Authors", Win, 0, 0, 0, 0, 0 ),
  Menu_item1 = create(MenuItem,"Matthew Reilly",MyMenu1,0,0,0,0,0),
  Menu_item2 = create(MenuItem,"Andy McNabb",MyMenu1,0,0,0,0,0),
  Menu_item3 = create(MenuItem,"Chris Ryan",MyMenu1,0,0,0,0,0),
MyMenu2 = create( Menu, "List of Female Authors", Win, 0, 0, 0, 0, 0 ),
  Menu_item4 = create(MenuItem,"Anne McCaffrey",MyMenu2,0,0,0,0,0),
  Menu_item5 = create(MenuItem,"Ursula le Guin",MyMenu2,0,0,0,0,0),
  Menu_item6 = create(MenuItem,"Nancy Kress",MyMenu2,0,0,0,0,0)

procedure onClick_MI(integer self, integer event, sequence parms)
    atom void
    atom posn
    atom hmenu
    atom pstring
    sequence text
    integer parent
trace(1)
    -- Find out which menu this belongs to.
    parent = findParent(self)
    -- The menu's handle
    hmenu = getHandle(parent)

    -- Allocate a largish text buffer
    pstring = acquire_mem(0, 3000)
    -- Get the current menu item text
    void = w32Func(xGetMenuString, {hmenu, self, pstring, 3000,
MF_BYCOMMAND})
    text = peek_string(pstring)
    release_mem(pstring)

    -- Append a '!' to the menu item text.
    pstring = acquire_mem(0, text & "!")
    void = w32Func(xModifyMenu, {hmenu, self, MF_BYCOMMAND, self, pstring})
    release_mem(pstring)

end procedure

setHandler({Menu_item1, Menu_item2, Menu_item3,
            Menu_item4, Menu_item5, Menu_item6}, w32HClick,
              routine_id("onClick_MI"))

  WinMain(Win,0)
-------------
Derek


----- Original Message -----
From: <jstory at freenet.edmonton.ab.ca>
To: "EUforum" <EUforum at topica.com>
Sent: Tuesday, February 05, 2002 8:11 AM
Subject: win32lib Q: Can a MenuItem be changed?


>
>
> ------ EXAMPLE
> constant
> MyMenu = create( Menu, "List of Items", Win, 0, 0, 0, 0, 0 ),
>   Menu_item = create(MenuItem,"Baba Yaga the Witch",MyMenu,0,0,0,0,0)
>
> setText(Menu_item,"Santa Claus")  -- This doesn't work.
>
> setCaption(Menu_item,"Santa Claus")  -- This doesn't work.
>
> ------ END OF EXAMPLE
>
> Can a MenuItem be changed?  If so, how in win32lib?
>
>
>        Jerry Story
>
>
>
>

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

5. Re: win32lib Q: Can a MenuItem be changed?

This is a multi-part message in MIME format.

------=_NextPart_000_0015_01C1AE28.7DBF52E0
	charset="iso-8859-1"

Tried to send this to Jerry, but my ISP seems to be dying a slow death...
< zero indexed >

> jstory at freenet.edmonton.ab.ca wrote:
> > Can a MenuItem be changed?  If so, how in win32lib?
> It should be possible using a call to w32Func(xModifyMenu, ...). I'll play
> around with it...


------=_NextPart_000_0015_01C1AE28.7DBF52E0
Content-Type: application/x-zip-compressed;
	name="themenu3.zip"

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

Search



Quick Links

User menu

Not signed in.

Misc Menu