1. Can I just confirm Alt handling etc

I have a button (or two):
constant Browse = create( PushButton, "&Browse", blah blah
...
procedure onclickBrowse()
	blah blah
onClick[Browse]=routine_id("onclickBrowse")

works fine. Alt B correctly shifts focus to the button.

At the mo, Alt B does not invoke onclickBrowse().
(not exactly surprised, I guess I ain't told it to yet)

Question:: Do I need:
onKeyDown [ xxx ] = routine_id("xxx")
for *every* widget to point to the same routine,
then, via getSelf() figure out what to do for eg Return,
and trap/process Alt B (and all the other buttons) in one place?

Is that the "best" way to code it?

Can I rely on "onKeyDown[<not specified>]" looking up & invoking the
parent, or not?

Pete

new topic     » topic index » view message » categorize

2. Re: Can I just confirm Alt handling etc

Pete,

Maybe I'm not understanding, but as far as I can see you don't need to do
*anything* other than set the ampersand in the name of the button to make
alt-whatever activate the onclick event.

This example works fine for me, with NO onKey events specified:

--  code generated by Win32Lib IDE v0.10.6

include Win32Lib.ew
without warning

----
--  Window Window1
global constant Window1 = create( Window, "Window1", 0, Default, Default,
400, 300, 0 )
global constant StatusBar5 = create( StatusBar, "StatusBar5", Window1, 0, 0,
0, 0, 0 )
global constant PushButton2 = create( PushButton, "&PushButton2", Window1,
24, 36, 90, 30, 0 )
global constant PushButton3 = create( PushButton, "P&ushButton3", Window1,
196, 44, 90, 30, 0 )
global constant PushButton4 = create( PushButton, "Pu&shButton4", Window1,
52, 116, 90, 30, 0 )
----
procedure PushButton2_onClick ()
  setText(StatusBar5, "Button2")
end procedure
onClick[PushButton2] = routine_id("PushButton2_onClick")

----
procedure PushButton3_onClick ()
 setText(StatusBar5, "Button3")
end procedure
onClick[PushButton3] = routine_id("PushButton3_onClick")

----
procedure PushButton4_onClick ()
 setText(StatusBar5, "Button4")
end procedure
onClick[PushButton4] = routine_id("PushButton4_onClick")



WinMain( Window1, Normal )
----- Original Message -----
From: <petelomax at blueyonder.co.uk>
To: "EUforum" <EUforum at topica.com>
Sent: Thursday, March 21, 2002 4:22 PM
Subject: Can I just confirm Alt handling etc



I have a button (or two):
constant Browse = create( PushButton, "&Browse", blah blah
...
procedure onclickBrowse()
blah blah
onClick[Browse]=routine_id("onclickBrowse")

works fine. Alt B correctly shifts focus to the button.

At the mo, Alt B does not invoke onclickBrowse().
(not exactly surprised, I guess I ain't told it to yet)

Question:: Do I need:
onKeyDown [ xxx ] = routine_id("xxx")
for *every* widget to point to the same routine,
then, via getSelf() figure out what to do for eg Return,
and trap/process Alt B (and all the other buttons) in one place?

Is that the "best" way to code it?

Can I rely on "onKeyDown[<not specified>]" looking up & invoking the
parent, or not?

Pete

new topic     » goto parent     » topic index » view message » categorize

3. Re: Can I just confirm Alt handling etc

On Fri, 22 Mar 2002 06:56:42 -0800, Dan Moyer
<DANIELMOYER at prodigy.net> wrote:

>This example works fine for me, with NO onKey events specified:

Thanks, your example worked fine for me, but my code just don't
I have studied it & studied it till I'm blue in the face and I just
can't for the life of me see the difference between that & this:

include win32lib.ew

constant 
	COMPARE = create( Window, "Compare", 0, 100, 100, 500, 180, 0),
	Browse = create( PushButton, "&Browse", COMPARE, 405, 40, 80, 25,
0 ),
	Compare = create( PushButton, "&Compare", COMPARE, 405, 75, 80,
25, 0 ),
	StatusBar5 = create( StatusBar, "No button pressed yet", COMPARE,
0, 0, 0, 0, 0 )

procedure onclickBrowse()
  setText(StatusBar5, "Browse button pressed")
end procedure
onClick[Browse]=routine_id("onclickBrowse")

procedure onclickCompare()
  setText(StatusBar5, "Compare button pressed")
end procedure
onClick[Compare]=routine_id("onclickCompare")

WinMain(COMPARE,Normal)

Yours, even more confused than ever,
Pete

new topic     » goto parent     » topic index » view message » categorize

4. Re: Can I just confirm Alt handling etc

Pete,
you have found a new bug in the library. The fix is simple though.
In the routine called isHotKey() find the line :

      if window_class[ focus ] = BUTTON and (event = WM_KEYDOWN)

then change it to :

      if window_class[ focus ] = BUTTON and
            ((event = WM_KEYDOWN) or (event = WM_SYSKEYDOWN))

There is still something else wrong somewhere in that it beeps when the
control already has focus, but I'll work on that issue later.

-------------
Derek.

----- Original Message -----
From: <petelomax at blueyonder.co.uk>
To: "EUforum" <EUforum at topica.com>
Sent: Saturday, March 23, 2002 4:53 AM
Subject: Re: Can I just confirm Alt handling etc



On Fri, 22 Mar 2002 06:56:42 -0800, Dan Moyer
<DANIELMOYER at prodigy.net> wrote:

>This example works fine for me, with NO onKey events specified:

Thanks, your example worked fine for me, but my code just don't
I have studied it & studied it till I'm blue in the face and I just
can't for the life of me see the difference between that & this:

include win32lib.ew

constant
COMPARE = create( Window, "Compare", 0, 100, 100, 500, 180, 0),
Browse = create( PushButton, "&Browse", COMPARE, 405, 40, 80, 25,
0 ),
Compare = create( PushButton, "&Compare", COMPARE, 405, 75, 80,
25, 0 ),
StatusBar5 = create( StatusBar, "No button pressed yet", COMPARE,
0, 0, 0, 0, 0 )

procedure onclickBrowse()
  setText(StatusBar5, "Browse button pressed")
end procedure
onClick[Browse]=routine_id("onclickBrowse")

procedure onclickCompare()
  setText(StatusBar5, "Compare button pressed")
end procedure
onClick[Compare]=routine_id("onclickCompare")

WinMain(COMPARE,Normal)

Yours, even more confused than ever,
Pete

new topic     » goto parent     » topic index » view message » categorize

5. Re: Can I just confirm Alt handling etc

On Fri, 22 Mar 2002 18:27:01 +0000, Chris Bensler <bensler at mail.com>
wrote:

>
>Why does the accelerator activate the onClick event?

When I found it didn't I assumed it was by design.
I studied some other code, couldn't see why, gave up & posted a query.

>I tried your example Pete, and it works fine.

HELLS BELLS. I thought it was bad enuf when Dan's code worked and mine
didn't. As a sanity check I just searched the source code of the
interpreter and couldn't find the line
	 "if Code_Written_By==Pete_Lomax & 
		Person_Running_Code==Pete_Lomax"

If it is some setting on my PC why does Dan's code work, not mine?

<HEAD BUTTS WALL>
ouch
</HEAD BUTTS WALL>

Pete (seriously losing the plot now)

new topic     » goto parent     » topic index » view message » categorize

6. Re: Can I just confirm Alt handling etc

----- Original Message -----
From: <petelomax at blueyonder.co.uk>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Can I just confirm Alt handling etc



On Fri, 22 Mar 2002 18:27:01 +0000, Chris Bensler <bensler at mail.com>
wrote:

>
>Why does the accelerator activate the onClick event?

When I found it didn't I assumed it was by design.
I studied some other code, couldn't see why, gave up & posted a query.

>I tried your example Pete, and it works fine.

HELLS BELLS. I thought it was bad enuf when Dan's code worked and mine
didn't. As a sanity check I just searched the source code of the
interpreter and couldn't find the line
"if Code_Written_By==Pete_Lomax &
Person_Running_Code==Pete_Lomax"

If it is some setting on my PC why does Dan's code work, not mine?

<HEAD BUTTS WALL>
ouch
</HEAD BUTTS WALL>

Pete (seriously losing the plot now)

----------
I dunno Pete. Neither yours nor Dan's worked on mine until I repaired the
library.

----
Derek.

new topic     » goto parent     » topic index » view message » categorize

7. Re: Can I just confirm Alt handling etc

----- Original Message -----
From: "Chris Bensler" <bensler at mail.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: Can I just confirm Alt handling etc


>
> Why does the accelerator activate the onClick event?
>
Because this is Window convention. The Alt-<x> for button-type controls is
supposed to set focus to it, and invoke the click event.

> I tried your example Pete, and it works fine.
> ALT-B = "Browse button pressed"
> ALT-C = "Compare button pressed"
>
> Although, windows chimes when I press ALT-key, and the buttons aren't
> depressed when ALT-key is pressed.

Maybe you are using a corrected version of the library already.

-----------
Derek.

new topic     » goto parent     » topic index » view message » categorize

8. Re: Can I just confirm Alt handling etc

Pete,

Your example works fine for me, pressing <alt> b or c give the associated
message in status bar; bell dings with <alt><either> but not with click on
button, and the "dotted" frame inside the button changes to whichever
associated key was pressed but does not depress.  I'm running with Win32Lib
55x1.

I doubt this is the cause of the difference between how these examples are
working for different people,  but I have my system set up to run programs
when *single* clicked, instead of double-clicked.

:)

Dan

----- Original Message -----
From: <petelomax at blueyonder.co.uk>
To: "EUforum" <EUforum at topica.com>
Sent: Friday, March 22, 2002 9:53 AM
Subject: Re: Can I just confirm Alt handling etc



On Fri, 22 Mar 2002 06:56:42 -0800, Dan Moyer
<DANIELMOYER at prodigy.net> wrote:

>This example works fine for me, with NO onKey events specified:

Thanks, your example worked fine for me, but my code just don't
I have studied it & studied it till I'm blue in the face and I just
can't for the life of me see the difference between that & this:

include win32lib.ew

constant
COMPARE = create( Window, "Compare", 0, 100, 100, 500, 180, 0),
Browse = create( PushButton, "&Browse", COMPARE, 405, 40, 80, 25,
0 ),
Compare = create( PushButton, "&Compare", COMPARE, 405, 75, 80,
25, 0 ),
StatusBar5 = create( StatusBar, "No button pressed yet", COMPARE,
0, 0, 0, 0, 0 )

procedure onclickBrowse()
  setText(StatusBar5, "Browse button pressed")
end procedure
onClick[Browse]=routine_id("onclickBrowse")

procedure onclickCompare()
  setText(StatusBar5, "Compare button pressed")
end procedure
onClick[Compare]=routine_id("onclickCompare")

WinMain(COMPARE,Normal)

Yours, even more confused than ever,
Pete

new topic     » goto parent     » topic index » view message » categorize

9. Re: Can I just confirm Alt handling etc

----- Original Message -----
From: "Chris Bensler" <bensler at mail.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: Can I just confirm Alt handling etc


>
>
> Derek Parnell wrote:
> > ----- Original Message -----
> > From: "Chris Bensler" <bensler at mail.com>
> > To: "EUforum" <EUforum at topica.com>
> > Sent: Saturday, March 23, 2002 5:27 AM
> > Subject: RE: Can I just confirm Alt handling etc
> >
> > Maybe you are using a corrected version of the library already.
> >
> > -----------
> > Derek.
>
> Maybe you're using a modified version? :)
>
> Chris
>

LOL. Yes the joke's on me. I am using a different version. In the one I'm
using, I had added the test for WM_KEYDOWN to get around another bug, but by
doing so I introduced a new one.

Thanks, Chris.

----------
Derek.

new topic     » goto parent     » topic index » view message » categorize

10. Re: Can I just confirm Alt handling etc

On Sat, 23 Mar 2002 16:31:15 +1100, Derek Parnell
<ddparnell at bigpond.com> wrote:


>LOL. Yes the joke's on me. I am using a different version. In the one I'm
>using, I had added the test for WM_KEYDOWN to get around another bug, but by
>doing so I introduced a new one.
>
Same here. Thanks, it all works now.

Pete

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu