From: Roger B. <sf...@bi...> - 2012-09-26 13:43:50
|
Hi, the reason for this behaviour is the following routine: ::method onCheckboxChanged unguarded expose Column. use arg id, itemIndex, state itemIndex += 1 say ID 'Checked row:' itemIndex Column.itemIndex.2 'state:' State Column.itemIndex.4 = State return 0 Any time a row is added this method is executed. And here the cat biting in its own tail : list~check() cannot run before list~addrow and list~addrow change indirect my parameter. Any hint to solve this problem in a more elegant way than using a temporary parm? Regards Roger Von: Roger Bilau [mailto:sf...@bi...] Gesendet: Mittwoch, 26. September 2012 15:04 An: 'Open Object Rexx Users' Betreff: [Oorexx-users] A strange behavior of the listview function Hello, currently I fight with the listview function. My first try was: ::method initDialog expose Column. -- Get a reference to the list view. list = self~newListView(IDC_LISTVIEW) list~addExtendedStyle("FULLROWSELECT GRIDLINES CHECKBOXES HEADERDRAGDROP") list~insertColumn(0, "Select", 25) list~insertColumn(1, "Column Name", 75) list~insertColumn(2, "Column Type", 45) do i = 1 to Column.0 trace ?i say column.i.2 column.i.3 column.i.4 column.i.5 list~addRow(i, , , Column.i.2, Column.i.5) If column.i.4 = 'CHECKED' then list~check(i-1) say column.i.2 column.i.3 column.i.4 column.i.5 end The trace output show this: 292 *-* say column.i.2 column.i.3 column.i.4 column.i.5 >C> COLUMN.I.2 => "COLUMN.1.2"? >V> COLUMN.I.2 => "IDNR"? >C> COLUMN.I.3 => "COLUMN.1.3"? >V> COLUMN.I.3 => "CHAR"? >O> " " => "IDNR CHAR" >C> COLUMN.I.4 => "COLUMN.1.4"? >V> COLUMN.I.4 => "CHECKED"? >O> " " => "IDNR CHAR CHECKED" >C> COLUMN.I.5 => "COLUMN.1.5"? >V> COLUMN.I.5 => "CHARACTER"? >O> " " => "IDNR CHAR CHECKED CHARACTER" >>> "IDNR CHAR CHECKED CHARACTER" IDNR CHAR CHECKED CHARACTER ß------------------------------------------------------- +++ Interactive trace. "Trace Off" to end debug, ENTER to Continue. +++ 294 *-* list~addRow(i, , , Column.i.2, Column.i.5) >V> LIST => "a ListView" >V> I => "1" >A> "1" >A> "" >A> "" >C> COLUMN.I.2 => "COLUMN.1.2"? >V> COLUMN.I.2 => "IDNR"? >A> "IDNR" >C> COLUMN.I.5 => "COLUMN.1.5"? >V> COLUMN.I.5 => "CHARACTER"? >A> "CHARACTER" 200 Checked row: 1 IDNR state: UNCHECKED >>> "0" 295 *-* If column.i.4 = 'CHECKED' >C> COLUMN.I.4 => "COLUMN.1.4"? >V> COLUMN.I.4 => "UNCHECKED"? >L> "CHECKED" >O> "=" => "0" >>> "0" 296 *-* say column.i.2 column.i.3 column.i.4 column.i.5 >C> COLUMN.I.2 => "COLUMN.1.2"? >V> COLUMN.I.2 => "IDNR"? >C> COLUMN.I.3 => "COLUMN.1.3"? >V> COLUMN.I.3 => "CHAR"? >O> " " => "IDNR CHAR" >C> COLUMN.I.4 => "COLUMN.1.4"? >V> COLUMN.I.4 => "UNCHECKED"? >O> " " => "IDNR CHAR UNCHECKED" >C> COLUMN.I.5 => "COLUMN.1.5"? >V> COLUMN.I.5 => "CHARACTER"? >O> " " => "IDNR CHAR UNCHECKED CHARACTER" >>> "IDNR CHAR UNCHECKED CHARACTER" IDNR CHAR UNCHECKED CHARACTER ß--------------------------------------------------------------------- After one hour changing, reading, traceing I changed the source to this: do i = 1 to Column.0 trace ?i say column.i.2 column.i.3 column.i.4 column.i.5 if column.i.4 = 'CHECKED' then kk=1 else kk=0 ff=i-1 list~addRow(i, , , Column.i.2, Column.i.5) If kk = 1 then list~check(ff) say column.i.2 column.i.3 column.i.4 column.i.5 end and got this trace output: 292 *-* say column.i.2 column.i.3 column.i.4 column.i.5 >C> COLUMN.I.2 => "COLUMN.1.2"? >V> COLUMN.I.2 => "IDNR"? >C> COLUMN.I.3 => "COLUMN.1.3"? >V> COLUMN.I.3 => "CHAR"? >O> " " => "IDNR CHAR" >C> COLUMN.I.4 => "COLUMN.1.4"? >V> COLUMN.I.4 => "CHECKED"? >O> " " => "IDNR CHAR CHECKED" >C> COLUMN.I.5 => "COLUMN.1.5"? >V> COLUMN.I.5 => "CHARACTER"? >O> " " => "IDNR CHAR CHECKED CHARACTER" >>> "IDNR CHAR CHECKED CHARACTER" IDNR CHAR CHECKED CHARACTER ß-------------------------------------------------------- +++ Interactive trace. "Trace Off" to end debug, ENTER to Continue. +++ 293 *-* if column.i.4 = 'CHECKED' >C> COLUMN.I.4 => "COLUMN.1.4"? >V> COLUMN.I.4 => "CHECKED"? >L> "CHECKED" >O> "=" => "1" >>> "1" 293 *-* then 293 *-* kk=1 >L> "1" >>> "1" >=> KK <= "1" 295 *-* ff=i-1 >V> I => "1" >L> "1" >O> "-" => "0" >>> "0" >=> FF <= "0" 296 *-* list~addRow(i, , , Column.i.2, Column.i.5) >V> LIST => "a ListView" >V> I => "1" >A> "1" >A> "" >A> "" >C> COLUMN.I.2 => "COLUMN.1.2"? >V> COLUMN.I.2 => "IDNR"? >A> "IDNR" >C> COLUMN.I.5 => "COLUMN.1.5"? >V> COLUMN.I.5 => "CHARACTER"? >A> "CHARACTER" 200 Checked row: 1 IDNR state: UNCHECKED >>> "0" 297 *-* If kk = 1 >V> KK => "1" >L> "1" >O> "=" => "1" >>> "1" 297 *-* then 297 *-* list~check(ff) >V> LIST => "a ListView" >V> FF => "0" >A> "0" 200 Checked row: 1 IDNR state: CHECKED >>> "0" 298 *-* say column.i.2 column.i.3 column.i.4 column.i.5 >C> COLUMN.I.2 => "COLUMN.1.2"? >V> COLUMN.I.2 => "IDNR"? >C> COLUMN.I.3 => "COLUMN.1.3"? >V> COLUMN.I.3 => "CHAR"? >O> " " => "IDNR CHAR" >C> COLUMN.I.4 => "COLUMN.1.4"? >V> COLUMN.I.4 => "CHECKED"? >O> " " => "IDNR CHAR CHECKED" >C> COLUMN.I.5 => "COLUMN.1.5"? >V> COLUMN.I.5 => "CHARACTER"? >O> " " => "IDNR CHAR CHECKED CHARACTER" >>> "IDNR CHAR CHECKED CHARACTER" IDNR CHAR CHECKED CHARACTER ß--------------------------------------------------------------------- The question is: what changed the value of column.i.4 from CHECKED to UNCHECKED in the first source??? In my opinion both routine should work in the same way, but they dont. Is this a bug or where is my mistake? Regards Roger |