Re: win32lib setEnable(), isEnabled() ?

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

On Sat, 25 Dec 1999 18:11:42 -0500, wolfgang fritz wrote:

>Does anyone know how to disable a button so it will NOT process onClick[]'s
>?
>I've tried all kinds of setEnable(Mybutton,0),
>and tests using isEnabled, and:
>...that button STILL processes an onClick routine !
>so if a user goes click,click,click... he's done two things too soon sad
>Wolf
>
>http://www.king.igs.net/~wolfritz
>http://www.king.igs.net/~wolfritz/tutor.htm

setEnable should do the trick...  Using the test program below, the highest
value 'count' will get is '1' no matter how fast I click on the button.

-- start test code --

include win32lib.ew

constant
  Win = create( Window, "Test", 0, Default, Default, 100, 100, 0 ),
  Txt1 = create( LText, "Count = 0", Win, 10, 10, 100, 20, 0 ),
  Btn1 = create( PushButton, "Click", Win, 10, 40, 50, 20, 0 )

integer count
  count = 0

procedure onClick_Btn1()
  setEnable( Btn1, False )
  count += 1
  setText( Txt1, sprintf( "Count = %d", count ) )
end procedure
onClick[Btn1] = routine_id( "onClick_Btn1" )

WinMain( Win, Normal )

-- end test code --


Perhaps you are overlooking something in your program...  or your version
of Win32Lib has a bug.  I'm using yesterday's Bleeding Edge release.

-- Brian

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

Search



Quick Links

User menu

Not signed in.

Misc Menu