punkie
(Getting the hang of it)
2002-10-31 11:16 AM
Kixforms - Listbox Bug

When you click on an item in a listbox it refuses to change the colour of the label even if it's set. Looks like a bug to me - it works however with a textbox.

code:
$listbox = $form.ListBox("")
$listbox.Size=110,255
$listbox.Location=15,80
$listbox.BorderStyle=1

$listbox.AddItem("My Item")
$listbox.OnClick = "Display()"

function Display()
$text = $form.Label("This my item",140,80,200,16)
$text.BackColor = 255,255,255
endfunction



JochenAdministrator
(KiX Supporter)
2002-10-31 11:51 AM
Re: Kixforms - Listbox Bug

punkie,

no buggy boo , does this fit yer needs :

code:
 break on cls

$form = createobject("Kixtart.form")

$listbox = $form.ListBox("")
$listbox.Size=110,255
$listbox.Location=15,80
$listbox.BorderStyle=1
$ListBox.default = 1

$listbox.AddItem("My Item")
$ListBox.AddItem("My next Item")
$listbox.OnClick = "ShowItem($$listbox.List($$Listbox.ListIndex))"

$text = $form.Label($Item,140,80,200,16)
$text.BackColor = 255,255,255

$form.show

while $Form.visible
$= execute($Form.DoEvents())
loop

quit()

function ShowItem($item)
$Text.Caption = $item
endfunction

Jochen


JochenAdministrator
(KiX Supporter)
2002-10-31 11:53 AM
Re: Kixforms - Listbox Bug

Btw.

You can't use DISPLAY() as a function name because it's already a Kixtart command [Wink]


JochenAdministrator
(KiX Supporter)
2002-10-31 11:59 AM
Re: Kixforms - Listbox Bug

Yet another hint :

to fill a Listbox on the fly you can also use this :

code:
$ListBox.List = "Item 1","Item 2","Item 3"

hth

Jochen


punkie
(Getting the hang of it)
2002-11-01 12:10 AM
Re: Kixforms - Listbox Bug

I saw a bug in my code! forgot to call the label before the function so it only changed colour when you clicked on the item twice.

I just used the Display() thing as an example tho.
Thanks for the assistance [Smile]