getText not returning value and getIndex returning 0 bug?

new topic     » topic index » view thread      » older message » newer message

Hi,

I've put together an example which demonstrates that getText() & getIndex() on a Combo don't report the value if the value was typed rather than selected using the mouse. Please try running the following example code which provides steps to demonstrate the issue.

--  code generated by Win32Lib IDE v1.0.4 Build July-06-2008 
 
constant TheProgramType="exw"  
  
include Win32lib.ew 
without warning 
 
-------------------------------------------------------------------------------- 
--  Window Window1 
constant Window1 = createEx( Window, "getText & getIndex bug?", 0, Default, Default, 591, 433, 0, 0 ) 
constant LText6 = createEx( LText, "Below are two combo drop downs. Each one causes the label beneath it to display " & 
	"the getText() result of the left combo when the dropdown OnChange fires.\n\nBug demo\n1. Select N in left combo " & 
	"using mouse\n2. Notice beneath reports \"getText(LeftCombo) = N\" and \"getIndex(LeftCombo) = 1\"\n3. Select a " & 
	"value in right combo\n4. Again below is shown \"getText(LeftCombo) = N\" and \"getIndex(LeftCombo) = 1\"\n6. Now " & 
	"type Y into LeftCombo dropdown using keyboard\n7. Beneath shows \"getText(LeftCombo) = Y\" and \"getIndex(LeftCombo) " & 
	"= 1\" - NOTICE getIndex value is wrong\n8. Now change option in right combo\n9. Beneath shows \"getText(LeftCombo) =" & 
	" \" and \"getIndex(LeftCombo) = 0\".\n\nThis is the bug.\nThere is no value reported for LeftCombo now by " & 
	"getText(LeftCombo) and getIndex(LeftCombo) returns 0", Window1, 20, 16, 552, 216, 0, 0 ) 
constant LText7 = createEx( LText, "LeftCombo:", Window1, 20, 256, 148, 20, 0, 0 ) 
constant LText8 = createEx( LText, "RightCombo:", Window1, 296, 256, 148, 20, 0, 0 ) 
constant LeftCombo = createEx( Combo, "", Window1, 20, 280, 148, 20*6, 0, 0 ) 
addItem(LeftCombo, "N") 
addItem(LeftCombo, "Y") 
constant RightCombo = createEx( Combo, "", Window1, 296, 280, 148, 20*6, 0, 0 ) 
addItem(RightCombo, "option 1") 
addItem(RightCombo, "option 2") 
constant LTextL1 = createEx( LText, "Shows LeftCombo value when LeftCombo changed", Window1, 24, 316, 264, 20, 0, 0 ) 
constant LTextR1 = createEx( LText, "Shows LeftCombo value when RightCombo changed", Window1, 300, 316, 268, 20, 0, 0 ) 
constant LTextL2 = createEx( LText, "", Window1, 24, 336, 264, 20, 0, 0 ) 
constant LTextR2 = createEx( LText, "", Window1, 300, 336, 268, 20, 0, 0 ) 
--------------------------------------------------------- 
-------------------------------------------------------------------------------- 
procedure LeftCombo_onChange (integer self, integer event, sequence params)--params is () 
setText(LTextL1, "getText(LeftCombo) = " & getText(self)) 
setText(LTextL2, "getIndex(LeftCombo) = " & sprint(getIndex(LeftCombo))) 
end procedure 
setHandler( LeftCombo, w32HChange, routine_id("LeftCombo_onChange")) 
-------------------------------------------------------------------------------- 
procedure RightCombo_onChange (integer self, integer event, sequence params)--params is () 
setText(LTextR1, "getText(LeftCombo) = " & getText(LeftCombo)) 
setText(LTextR2, "getIndex(LeftCombo) = " & sprint(getIndex(LeftCombo))) 
end procedure 
setHandler( RightCombo, w32HChange, routine_id("RightCombo_onChange")) 
--------------------------------------------------------- 
 
 
WinMain( Window1,Normal ) 

I've tried this on both win32lib 0.60.6 and 0.70.4. Perhaps I'm misunderstanding how it should work, but I'm looking to cope with users that may use their mouse or may use their keyboard. I guess I can code around this issue by storing the changed value the moment it's changed in the LeftCombo_onChange routine, but I'd expected to be able to rely on using getText(LeftCombo) or getIndex(LeftCombo) at a later point.

Cheers,
Mark

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu