April 30, 2024, 10:24:58 AM

News:

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


Multi-Column Listbox

Started by GWS, October 14, 2010, 09:31:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GWS

Hi,

Here's an example program from a long time ago (2002), showing the use of a multi-column listbox.

CBasic (IBasic) has a long history ..  ;D


' code by Joey and Paul for multi-column listbox - 2002
' slightly modified to give the listbox style constants used

DEF started,n,w:int
DEF nw[101],temphold$:string

DEF d1:dialog

DIALOG d1,0,0,360,220,0x80C80080,0,"Multi-Column Listbox",Handler
CONTROL d1,"L,,11,5,340,152,(@hscroll|@ctlistcolumns|@ctlistnotify),1"

CONTROL d1,"T,,80,180,400,15,@tabstop,2"

nw[1] = "One","Two","Three","Four"
nw[5] = "Five","Six","Seven","Eight"
nw[9] = "Nine","Ten","Eleven","Twelve"
nw[13] = "Thirteen","Fourteen","Fifteen"
nw[16] = "Sixteen","Seventeen","Eighteen"
nw[19] = "Nineteen","Twenty"
nw[30] = "Thirty": nw[40] = "Forty": nw[50] = "Fifty": nw[60] = "Sixty"
nw[70] = "Seventy": nw[80] = "Eighty": nw[90] = "Ninety"
nw[100] = "One Hundred"

for n = 20 to 90 #10
temphold$ = nw[n] + " "

for x = 1 to 9
nw[n+x] = temphold$ + nw[x]
next x

next n

started = DOMODAL(d1)
end

' the message handler subroutine for the dialog
Handler:
select @CLASS
case @IDCONTROL
select @CONTROLID
case 1
def tx:string
def x:int
x = GETSELECTED (D1, 1)
tx = "You selected number "
tx = tx + ucase$(getstring(d1,1,x))
if x = -1 then tx = "Nothing Selected"
setcontroltext d1,2,tx
endselect

' all controls in a dialog window should be initialized in response to @IDINITDIALOG
case @IDINITDIALOG
SETLBCOLWIDTH d1,1,85
for x = 1 to 100
addstring d1,1,nw[x]
next x
case @IDCLOSEWINDOW
CLOSEDIALOG d1, @IDOK
endselect

return



best wishes, :)

Graham
Tomorrow may be too late ..