Re: better example

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hey, Jordah, I answered this on the 8'th already, but here goes again...
< quoting <snipped> from your example >

constant SimpleWin =  create( Window, "Simple Window", 0, 0, 0, 300,
100, 0 ),
         menu      =  create(Menu,"File",SimpleWin,0,0,0,0,0),
         menu1     =  create(MenuItem,"New",menu,0,0,0,0,0),
         menu2     =  create(MenuItem,"Old",menu,0,0,0,0,0),
-- added !
menu3 = create(MenuItem,"Check First Item",menu,0,0,0,0,0)

-- new stuff ! -- crude, but ...
constant
MIIM_STATE = 1,
zGetMenuItemInfo=registerw32Function(user32,"GetMenuItemInfoA",{C_INT,
C_INT, C_INT, C_INT}, C_INT)

function isMenuRadioed(atom hMenu,atom uItem,integer fByPosition)
atom MENUITEMINFO,junk,out
MENUITEMINFO = acquire_mem(0,48)
mem_set(MENUITEMINFO,0,48)
poke4(MENUITEMINFO+0,48)
poke4(MENUITEMINFO+4,MIIM_STATE)
junk=w32Func(zGetMenuItemInfo,{hMenu,uItem,fByPosition,MENUITEMINFO})
if junk then
out = and_bits(peek4u(MENUITEMINFO+12),MFS_CHECKED)
else -- crash_error!
end if
release_mem(MENUITEMINFO)
return out
end function

procedure w32HClick_menu3(integer self,integer event,sequence params)
--check item zero/by position
if isMenuRadioed(getHandle(menu),0,1) then
setText(SimpleWin," YES") else setText(SimpleWin," NO")
end if
end procedure
setHandler(menu3,w32HClick,routine_id("w32HClick_menu3"))

Now, for a 'philosophical' question, to one and all.
Since your nice example proves that it's rather easy to add all this
functionality to a win32lib program *without*
adding it to the win32lib core, do we really need them 'included' ?
"Win32lib created" programs that actually use "bitmapped" menu's, and "radio's",
will probably be quite rare, in most
cases.
Things will be different, of course, when Derek 'breaks' win32lib into smaller
bits, but for now.... ???

Wolf

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu