March 28, 2024, 08:48:33 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Inserting a Menu Separator

Started by GWS, January 30, 2015, 12:11:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GWS

Hi,

A question was asked on Coding Monkeys as to how to insert a menu separator bar in a menu ..

To insert a separator when you write your Insertmenu statement, just insert a minus sign in the string ..


"I,-,0,0"


Here's an example program:


' Window Example 1
'
def w:window
def textWidth, textHeight, run : int
def a$ : string

autodefine "off"

window w,0,0,600,450,0,0,"Example 1",messages
setwindowcolor w, rgb(60,130,90)
centerwindow w

control w, "B, Exit, (600 - 60) / 2, 350, 60, 30, 0, 1"
setcontrolcolor w,1,0,rgb(0,150,200)

'  menu ..
menu w,"T,File,0,0","I,Open,0,1","I,Close,0,2","I,-1,0,0","I,Exit,0,100"

setfont w,"Times",25,600,@SFITALIC
frontpen w, RGB(210,210,210):' light grey

a$ = "Welcome to Creative Basic"
gettextsize w, a$, textWidth, textHeight
move w,(600 - textwidth) / 2,150
print w,a$

run = 1
waituntil run = 0
closewindow w
end

sub messages
select @CLASS
case @IDCLOSEWINDOW
' closing the window
run = 0
case @IDCHAR
' ESC(ape) key pressed will close the program ...
key = @CODE
if key = 27 then run = 0
case @IDCONTROL
select @CONTROLID
' Exit button ID 1 clicked ...
case 1
run = 0
endselect
case @idmenupick
select @menunum
case 100
run = 0
endselect
endselect
return


Best wishes, :)

Graham


Tomorrow may be too late ..

Egil

January 30, 2015, 02:12:23 PM #1 Last Edit: January 30, 2015, 07:07:29 PM by GWS
I really believed I knew most CB secrets....
But this one was new to me!

Thanks for sharing Graham!
Support Amateur Radio  -  Have a ham  for dinner!