1. Win32lib: clicks and focus problems with mouse vs. keyboard

Two for the price of one today.

1) One the first screen (Noisy Clicks"), selecting the radio buttons
with the mouse is fine, but using Alt A, B, or C causes a click to be
heard. It is the same noise I get from Alt D which I'd expect.

2) The second problem is that if you press the Focus button to get the
second window, then the lookup button, cursor up and down to the
required entry and press Enter, it works fine. If, however, you select
the entry by double clicking on it, the focus is messed up.

Pete
PS 0.59.1, win98.

--
-- Some clicking and some focus problems
--
without warning
include win32lib.ew
--if setAutoFocusLabels(True) then end if

constant main=3Dcreate(Window,"Noisy Clicks",0,100,100,200,200,0),
		 rA=3Dcreate(Radio,"&A",main,10,10,60,25,0),
		 rB=3Dcreate(Radio,"&B",main,80,10,60,25,0),
		 rC=3Dcreate(Radio,"&C",main,150,10,60,25,0),
		 subtn=3Dcreate(Button,"&Focus",main,80,60,60,25,0),
		 sub=3Dcreate(Window,"Focus",main,120,120,320,200,0),
		 ftxt=3Dcreate(LText,"&Focus",sub,10,40,40,25,0),
		 focus=3Dcreate(EditText,"",sub,50,40,100,25,0),=20
		 btn=3Dcreate(Button,"&Lookup",sub,180,40,60,25,0),
		 lookup=3Dcreate(Window,"Lookup",main,150,150,150,300,0),
		 list=3Dcreate(List,"",lookup,10,10,130,280,0)

addItem(list,{"one","two","three"})

-- Even this does not help
--procedure oncloselookup(integer self, integer event, sequence
params)
--	setFocus(focus)
--end procedure
--setHandler(lookup,w32HClose,routine_id("oncloselookup"))

procedure onsubtn(integer self, integer event, sequence params)
	openWindow(sub,Normal)
	setFocus(focus)
end procedure
setHandler(subtn,w32HClick,routine_id("onsubtn"))

procedure onbtn(integer self, integer event, sequence params)
	openWindow(lookup,Normal)
	setFocus(list)
end procedure
setHandler(btn,w32HClick,routine_id("onbtn"))

procedure onKeylookup(integer self, integer event, sequence params)
	if params[1] =3D VK_ENTER then
		closeWindow(lookup)
		setText(focus,"by key")
		setFocus(focus)
	end if
end procedure
setHandler(list,w32HKeyDown,routine_id("onKeylookup"))

procedure onMouselookup(integer self, integer event, sequence params)
	if params[1] =3D LeftDoubleClick then
		closeWindow(lookup)
		setText(focus,"by mouse")
		setFocus(focus)
	end if
end procedure
setHandler(list,w32HMouse,routine_id("onMouselookup"))

WinMain(main,Normal)

new topic     » topic index » view message » categorize

2. Re: Win32lib: clicks and focus problems with mouse vs. keyboard

----- Original Message -----
From: "Pete Lomax" <petelomax at blueyonder.co.uk>
To: "EUforum" <EUforum at topica.com>
Subject: Win32lib: clicks and focus problems with mouse vs. keyboard


>
>
> Two for the price of one today.
>
> 1) One the first screen (Noisy Clicks"), selecting the radio buttons
> with the mouse is fine, but using Alt A, B, or C causes a click to be
> heard. It is the same noise I get from Alt D which I'd expect.

Using Windows ME here, and I can't hear any clicks. Sorry, but I don't know
how to 'fix'.

> 2) The second problem is that if you press the Focus button to get the
> second window, then the lookup button, cursor up and down to the
> required entry and press Enter, it works fine. If, however, you select
> the entry by double clicking on it, the focus is messed up.
>

This one is a real pain. It appears that the List control grabs focus again
after a double click because there is a mouse up event after the double
click. With this in mind, I've recoded your example to cater for this...

integer dbc dbc = 0
procedure onMouselookup(integer self, integer event, sequence params)
if params[1] = LeftDoubleClick then
 dbc = 1
elsif params[1] = LeftUp and dbc = 1 then
 setText(focus,"by mouse")
 setFocus(focus)
 closeWindow(lookup)
 dbc = 0
end if
end procedure
setHandler(list,w32HMouse,routine_id("onMouselookup"))

However, it did find a situation which might of caused some bugs elsewhere
when a control in a closed window tries to take focus. I've now catered for
that situation, but I'm adverse to coding a special case for the List
Double-click effect.

--
Derek

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

3. Re: Win32lib: clicks and focus problems with mouse vs. keyboard

On Sun, 29 Jun 2003 08:48:32 +1000, Derek Parnell
<ddparnell at bigpond.com> wrote:

>
>
>----- Original Message -----
>From: "Pete Lomax" <petelomax at blueyonder.co.uk>
>To: "EUforum" <EUforum at topica.com>
>Subject: Win32lib: clicks and focus problems with mouse vs. keyboard
>
>
>> Two for the price of one today.
>>
>> 1) One the first screen (Noisy Clicks"), selecting the radio buttons
>> with the mouse is fine, but using Alt A, B, or C causes a click to be
>> heard. It is the same noise I get from Alt D which I'd expect.
>
>Using Windows ME here, and I can't hear any clicks. Sorry, but I don't =
know
>how to 'fix'.

Just checking: If you run Notepad and press (eg) Alt-K do you get a
click? You may have to increase the volume a bit to make it clear; in
contrast, Alt-F (which opens the File menu) is silent.

>
>> 2) The second problem is that if you press the Focus button to get the
>> second window, then the lookup button, cursor up and down to the
>> required entry and press Enter, it works fine. If, however, you select
>> the entry by double clicking on it, the focus is messed up.
>>
>
>This one is a real pain. It appears that the List control grabs focus =
again
>after a double click because there is a mouse up event after the double
>click. With this in mind, I've recoded your example to cater for this...
>
>integer dbc dbc =3D 0
>procedure onMouselookup(integer self, integer event, sequence params)
>if params[1] =3D LeftDoubleClick then
> dbc =3D 1
>elsif params[1] =3D LeftUp and dbc =3D 1 then
> setText(focus,"by mouse")
> setFocus(focus)
> closeWindow(lookup)
> dbc =3D 0
>end if
>end procedure
>setHandler(list,w32HMouse,routine_id("onMouselookup"))
>
Thanks. I'll code that as a temporary stopgap blink Did you notice my
follow-up re setEnable(list,False)?
I've also realised that a returnValue(-1) will cure this (question
being should I really have to code either).

>However, it did find a situation which might of caused some bugs =
elsewhere
>when a control in a closed window tries to take focus. I've now catered =
for
>that situation,
I'll retest when you release that, sounds pretty much what is wanted.
> but I'm adverse to coding a special case for the List
>Double-click effect.
Correct. When/if you find the bug (obviously) you'll fix it, but any
kind of silly interim fudge helps no-one.

Cheers,
Pete

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

4. Re: Win32lib: clicks and focus problems with mouse vs. keyboard

----- Original Message -----
From: "Pete Lomax" <petelomax at blueyonder.co.uk>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Win32lib: clicks and focus problems with mouse vs. keyboard


>
>
> On Sun, 29 Jun 2003 08:48:32 +1000, Derek Parnell
> <ddparnell at bigpond.com> wrote:
>
> >
> >----- Original Message -----
> >From: "Pete Lomax" <petelomax at blueyonder.co.uk>
> >To: "EUforum" <EUforum at topica.com>
> >Sent: Monday, June 23, 2003 10:28 PM
> >Subject: Win32lib: clicks and focus problems with mouse vs. keyboard
> >
> >
> >> Two for the price of one today.
> >>
> >> 1) One the first screen (Noisy Clicks"), selecting the radio buttons
> >> with the mouse is fine, but using Alt A, B, or C causes a click to be
> >> heard. It is the same noise I get from Alt D which I'd expect.
> >
> >Using Windows ME here, and I can't hear any clicks. Sorry, but I don't
know
> >how to 'fix'.
>
> Just checking: If you run Notepad and press (eg) Alt-K do you get a
> click? You may have to increase the volume a bit to make it clear; in
> contrast, Alt-F (which opens the File menu) is silent.
>

Nope. No clicks here. I think its clicking though because the KeyUp is
getting passed to Windows without the corresponding KeyDown event. I'll work
on that angle, anyhow.

[snip]
> >
> Did you notice my
> follow-up re setEnable(list,False)?
> I've also realised that a returnValue(-1) will cure this (question
> being should I really have to code either).

Yes, I've dealt with that now.

> >However, it did find a situation which might of caused some bugs
elsewhere
> >when a control in a closed window tries to take focus. I've now catered
for
> >that situation,
> I'll retest when you release that, sounds pretty much what is wanted.
> > but I'm adverse to coding a special case for the List
> >Double-click effect.
> Correct. When/if you find the bug (obviously) you'll fix it, but any
> kind of silly interim fudge helps no-one.

Technically, there is no bug as this is the Microsoft-defined behaviour for
List controls. It seems that MS in their wisdom has decided that for LIst
controls, a LeftButtonUp event follows the LeftDoubleClick event and that it
will retake the focus when it does happen.

--
Derek

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

Search



Quick Links

User menu

Not signed in.

Misc Menu