| Liberty BASIC - Help Online |
Week Five Homework Solution
'WK5SOL.BAS
'Week 5 Liberty BASIC Course
'Copyright 1996 - 2005 Shoptalk Systems
'All Rights Reserved
'Here is our solution for week 5 of our Liberty BASIC course
'------------------------------------------------------------------
'load our bitmaps
loadbmp "letter", "letter.bmp"
loadbmp "call", "call.bmp"
loadbmp "brochure", "brochure.bmp"
loadbmp "sale", "sale.bmp"
'setup our listbox choices
dim status$(4)
status$(0) = "letter"
status$(1) = "call"
status$(2) = "brochure"
status$(3) = "sale"
'no main window
nomainwin
'size the window
WindowWidth = 200
WindowHeight = 150
'setup our controls and open the window
statictext #main, "Select Status:", 10, 10, 120, 20
listbox #main.status, status$(, [loop], 10, 35, 120, 60
graphicbox #main.draw, 140, 35, 34, 34
open "Week 5 Homework" for dialog as #main
print #main, "trapclose [quit]"
'tell the listbox where to branch on a single-click
print #main.status, "singleclickselect [statusSelected]"
'wait here for user input
wait
[statusSelected] 'draw the icon for the selected status
print #main.status, "selection? selectedStatus$"
print #main.draw, "cls ; drawbmp "; selectedStatus$; " 0 0"
wait
[quit] 'exit the program
close #main
end
Copyright (C) 2005 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/