[futurebasic] change what appears in popupmenu

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2010 : Group Archive : Group : All Groups

From: Brian Heibert <heibert@...>
Date: Wed, 27 Jan 2010 11:12:48 -0500
Hi,

How do I change what appears in a popupmenu?

I got a problem that  1 popup is appearing twice insstead of 2 different menus

See...
http://www.macinternetpal.com/pencolor.png
http://www.macinternetpal.com/pensize.png

I want to have a pen color popup menu
and a pen size popup menu

local fn BuildPopMenu( id as long )
'~'1
dim as MenuRef m

menu id, 0, _enable, ""
menu id, 1, _enable, "Black;White;Red;Green;Blue;Cyan;Magenta;Yellow;-;Eraser;-;Select another color..."

m = fn GetMenuHandle( id )
DeleteMenu( id )
InsertMenu( m, -1 )
end fn

local fn BuildPopMenu1( id as long )
'~'1
dim as MenuRef m

menu id, 0, _enable, ""
menu id, 1, _enable, "1;2;3;4;5;6;7;8;9"
m = fn GetMenuHandle( id )
DeleteMenu( id )
InsertMenu( m, -1 )
end fn


local fn DoPopup( menuID as long )
'~'1
dim as Long     mItem
dim as Str255   txtStr
dim as MenuRef  mRef
dim as Long     outWnd

mItem = button( menuID )
mRef  = button( menuID, _FBgetControlMenuHandle )
call GetMenuItemText( mRef, mItem, @txtStr )

outWnd = window( _storyteller)
window output _storyteller
select case ( txtStr )
case "Black"  : Color = _zBlack
case "Yellow" : Color = _zYellow
case "Green"  : Color = _zGreen
case "Cyan"   : Color = _zCyan
case "Blue"   : Color = _zBlue
case "Magenta": Color = _zMagenta
case "Red"    : Color = _zRed
end select

if outWnd then window output outWnd

end fn

local fn DoPopUp1( menuID as long)
'~'1
dim as Long     mItem
dim as Str255   txtStr
dim as MenuRef  mRef
dim as Long     outWnd

mItem = button( menuID )
mRef  = button( menuID, _FBgetControlMenuHandle )
call GetMenuItemText( mRef, mItem, @txtStr )

outWnd = window( _storyteller)
window output _storyteller
select case (mItem)
case 1: PenSize( 1,1)
case 2: PenSize( 2,2)
case 3: PenSize( 3,3)
case 4: PenSize( 4,4)
case 5: PenSize( 5,5)
case 6: PenSize( 6,6)
case 7: PenSize( 7,7)
case 8: PenSize( 8,8)
case 9: PenSize( 9,9)
end select
end fn

fn BuildPopMenu( 101 )
fn BuildPopMenu1 (102)