Welcome, Guest. Please login or register.

Author Topic: Menu Separator  (Read 1671 times)

Offline GWS

  • Member
  • **
  • Posts: 72
    • View Profile
Menu Separator
« on: February 16, 2015, 09:08:46 PM »
Hi,

A question came up on the Coding Monkeys forum - How to add a menu separator .. :)

I was surprised how many views the discussion has received, so here's a small example program using a menu separator ..

Code: [Select]
' Menu Separator Example ..
'
def w:window
def textWidth, textHeight, run : int
def a$ : string

autodefine "off"

window w,0,0,600,450,0,0," Menu Separator Example",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(100,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
' close 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
' Window Exit button ID 1 clicked ...
         case 1
            run = 0
      endselect
   case @idmenupick
         select @menunum
            case 100                                       :' Menu Exit button ID 100 clicked ...
               run = 0
         endselect
endselect
return

Best wishes, :)

Graham

Offline Columbo

  • Administrator
  • Hero Member
  • *****
  • Posts: 511
  • Basic is alive and well!
    • View Profile
    • Divi-Help (For Divi Builder users.
Re: Menu Separator
« Reply #1 on: February 27, 2015, 12:53:03 PM »
Interesting!  Thanks Graham and good to see you back.  I have been really tied up lately but I should get time to be on more often soon.


John
New forum for DIVI Builder users. - http://www.divi-help.com