Listbox.bac

Page last edited 3,279 days ago
From bigbass code
Jump to navigation Jump to search

File:Listbox.png

' bacon-listbox.bac


' Include the files for making a GUI.
INCLUDE "hug.bac"
INIT

' we want to "echo out" which listbox was pressed
' this could launch another app use GRAB$
'------------------------
SUB My_listbox_demo()
'------------------------
 Listbox_selected$ =    GRAB$(My_listbox)
 PRINT Listbox_selected$
END SUB


' 1.) Create your main working window, 250  pixels wide x 130 pixels high
Mainwin = WINDOW( "BaCon listbox", 250, 130 )


' remember create, ATTACH ,CALLBACK ,SUB


Menu_label = MARK("Select an option from the Menu" , 220, 30)
ATTACH( Mainwin, Menu_label, 5, 0 )


My_listbox = LIST(180, 75)
TEXT(My_listbox ,"First choice" )
TEXT(My_listbox ,"Second choice" )
TEXT(My_listbox ,"Third choice" )
ATTACH( Mainwin, My_listbox, 5, 30 )
CALLBACK(My_listbox, My_listbox_demo)


DISPLAY