VLWeb CheckBox in a list

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
soa
Posts: 339
Joined: Mon Dec 07, 2015 3:15 pm

VLWeb CheckBox in a list

Post by soa »

I have a checkbox column in a list control and I've added a click event to it. My issue is that the checkbox always returns unchecked when clicked regardless of what I can see on the screen.

Evtroutine Handling(#ChkReviewed.Click)

#sys_web.console.log( ('Reviewed=' + #ChkReviewed.ButtonState) )

Endroutine

returns

Reviewed=UNCHECKED
Reviewed=UNCHECKED
Reviewed=UNCHECKED
Reviewed=UNCHECKED

when clicked on and off multiple times.

Any ideas?
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: VLWeb CheckBox in a list

Post by Stewart Marshall »

Hi Jim

The ButtonState property of a CheckBox column is the prototype state for all entries when added to the list. This is why it doesn't change.

To access the item that's just been clicked, you need to use the column's CurrentItem.ButtonState

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_WEB) Height(688) Width(816)
Define_Com Class(#PRIM_LIST) Name(#List1) DisplayPosition(1) Left(45) Parent(#COM_OWNER) TabPosition(1) Top(19) Height(366) Width(316)
Define_Com Class(#PRIM_LIST.Number) Name(#ColumnXDEMONUMB1) ColumnWidth(134) DisplayPosition(1) Increment(1) Parent(#List1) Source(#xDemoNumber) Wrap(False)
Define_Com Class(#PRIM_LIST.CheckBox) Name(#ColumnCheckBox1) ColumnWidth(78) DisplayPosition(2) Parent(#List1)
Define_Com Class(#PRIM_LABL) Name(#Label1) Caption('Label1') DisplayPosition(2) Ellipses(Word) Height(25) Left(392) Parent(#COM_OWNER) TabPosition(2) TabStop(False) Top(75) VerticalAlignment(Center) Width(201)

Evtroutine Handling(#COm_owner.CreateInstance)

Begin_Loop Using(#xDemoNumber) To(10)
Add_Entry To_List(#List1)
End_Loop

Endroutine

Evtroutine Handling(#ColumnCheckBox1.Click)

#Label1 := #List1.CurrentItem.Entry.AsString + " " + #ColumnCheckBox1.CurrentItem.ButtonState

Endroutine

End_Com
Regards
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
Post Reply