Re: Win32Lib bug

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

Ad Rienks, you are correct - there is still a bug in win32lib.ew.
I re-installed v2.0 and found that the original code
that you posted still dies when a 12-character string
is entered and clicked on. The code you posted
a few days later is what I debugged, and it seems to work fine now
along with every other example I've tried.

I'm almost certain there is another undersized data structure
lurking in win32lib.ew. I temporarily modified allocate()
in machine.e to always give the user 100 bytes more than he
asks for, and the 12-character bug went away. Furthermore,
I've found that heap corruption occurs in this program when
the extra 100 bytes are not provided. (maybe less than 100
would work - I didn't try).

David, maybe you can ask yourself which structures are used
in the following code, that aren't used in your other examples.
You might not be allocating quite enough space for them.

include win32lib.ew

constant
    Win   = create( Window, "List ++", 0, Default, Default, 160, 170, 0 ),
    List1 = create( List, "", Win, 10, 10, 120, 60, 0 ),
    Label1 = create(RText, "", Win, 10, 60, 120, 20, 0),
    Sle1    = create( EditText, "", Win, 10, 80, 110, 20, 0 ),
    Button1 = create( PushButton, "ADD", Win, 70, 110, 60, 20, 0 )

procedure onLoad_Win()
  -- add these items to the list-box
  addItem( List1, "one" )
  addItem( List1, "two" )
  addItem( List1, "three" )
  addItem( List1, "four" )
  setIndex(List1,0)
  setFocus(Sle1)
end procedure

procedure show_it(integer here)
-- show the selected list item in the text window.
sequence this
this=getItem(List1,here)
setText(Label1, this)
end procedure

procedure onChange_List1()
-- get the latest index from the list-box, then show it.
atom where
where=getIndex(List1)
show_it(where)
end procedure

procedure onClick_Button1( integer mouseX, integer mouseY )
sequence entry
  entry = getText( Sle1 )
  addItem( List1, entry )
  setText(Sle1, {} )
  setFocus(Sle1)
end procedure

onLoad[ Win ] = routine_id( "onLoad_Win" )
onChange[List1] = routine_id("onChange_List1")
onClick[ Button1 ] = routine_id("onClick_Button1")

WinMain( Win )


Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

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

Search



Quick Links

User menu

Not signed in.

Misc Menu