Re: Win32Lib Bugs

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

To Robert Craig:

This is the program that caused the error. When you add a string into the=

listbox that is exactly 12 characters long, and than later you go into th=
e
list using mouseclicks or the cursor keys, you will see what happens. Thi=
s
did not occur only on my machine; Wolfgang Fritz and David Cuny were able=

to reproduce the bug also.

-- from Ex06.exw by David Cuny
-- This opens a window with a populated list in it.
-- Wolf added onChange[] to show it's use.
-- then added a button and an SLE to "fill" the listbox.

include win32lib.ew

constant
    Win   =3D create( Window, "List ++", 0, Default, Default, 160, 170, 0=
 ),
    List1 =3D create( List, "", Win, 10, 10, 120, 60, 0 ),    =

--  ^^ create a list-box window.
    Label1 =3D create(RText, "", Win, 10, 60, 120, 20, 0),
--  ^^ create a right-justified text display window.
    Sle1    =3D create( EditText, "", Win, 10, 80, 110, 20, 0 ),
--  ^^ create a little single-line-entry window.
    Button1 =3D create( PushButton, "ADD", Win, 70, 110, 60, 20, 0 )
--  ^^ and last, add a button to do something.

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=3DgetItem(List1,here)
setText(Label1, this)
end procedure

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

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

onLoad[ Win ] =3D routine_id( "onLoad_Win" )
onChange[List1] =3D routine_id("onChange_List1")
-- ^^ this event handler is triggered whenever List1 changes state.
onClick[ Button1 ] =3D routine_id("onClick_Button1")

WinMain( Win )

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

Search



Quick Links

User menu

Not signed in.

Misc Menu