1. RE: win32lib: Tabbing between controls in/not in a group

Pete Lomax wrote:
> How can I tab between controls when one of them is in a group?
> Once it gets into the group, the cursor does not want to come out.
> Run the following program and press Tab five or more times to see what
> I mean (using 0.60.0; under 0.59.2 it skips the group, but that is not
> what I want either):
> 
> --
> -- test
> --
> include win32lib.ew
> constant
> MOUSEOPT = create( Window, "Mouse Options", 0, 120, 70, 340,
> 200,{WS_DLGFRAME,WS_SYSMENU}),
> MOUSESCROLLG = create( Group, "Scroll lines", MOUSEOPT, 10, 10, 95,
> 45, 0),
> MOUSESCROLL = create( EditText, "", MOUSESCROLLG, 15, 15, 30, 20, 0),
> ASIT = create( LText, "Autosave interval in seconds", MOUSEOPT,
> 10,70,200,20,0),
> ASI = create( EditText, "", MOUSEOPT, 210, 70, 60, 20, 0 ),
> ASTS = create( CheckBox, "Autosave on Tab Switch?", MOUSEOPT,
> 10,100,200,20,0),
> MOK = create( DefPushButton, "OK", MOUSEOPT, 130, 130, 65, 25, 0 )
> 
> WinMain(MOUSEOPT,Normal)

Yep.  I've run into this difficulty as well.  Here's the procedure I
use--it's not the most efficient solution, but it works. blink  Feel free to
improve upon it.

Also, note the use of the win32lib function setTabStops().

include win32lib.ew
constant
MOUSEOPT = create( Window, "Mouse Options", 0, 120, 70, 340,
200,{WS_DLGFRAME,WS_SYSMENU}),
MOUSESCROLLG = create( Group, "Scroll lines", MOUSEOPT, 10, 10, 95,
45, 0),
MOUSESCROLL = create( EditText, "", MOUSESCROLLG, 15, 15, 30, 20, 0),
ASIT = create( LText, "Autosave interval in seconds", MOUSEOPT,
10,70,200,20,0),
ASI = create( EditText, "", MOUSEOPT, 210, 70, 60, 20, 0 ),
ASTS = create( CheckBox, "Autosave on Tab Switch?", MOUSEOPT,
10,100,200,20,0),
MOK = create( DefPushButton, "OK", MOUSEOPT, 130, 130, 65, 25, 0 )

procedure setTabOrder(sequence flds)
--	Sets the global tabbing order for a window.
--	Using this procedure allows tabbing in and out of parent controls,
--	such as Windows, Groups, TabItems, etc., so that the user is not
"trapped"
--	when he tabs to a control inside one of these.
--	All control ids contained in flds must be in the same window.
	integer
		parent
	sequence
		parents
	parents = {}
	for i = 1 to length(flds) do
		parent = findParent(flds[i])
		if not find(parent, parents) then
			parents &= parent
		end if
	end for
	for i = 1 to length(parents) do
		VOID = setTabStops(parents[i], flds)
	end for
end procedure

setTabOrder({MOUSESCROLL, ASI, ASTS, MOK})

WinMain(MOUSEOPT,Normal)


new topic     » topic index » view message » categorize

2. RE: win32lib: Tabbing between controls in/not in a group

I've started working on a more generic 'solution' to this issue. 

If you look at the demo program "grouptab.exe" you can see one attempt
to do this. I had a look at this demo again last night, and concluded that
its overly complex and not very efficient. I'll work out something 
for a future release.

-- 
Derek Parnell
Melbourne, Australia

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

3. RE: win32lib: Tabbing between controls in/not in a group

Derek Parnell wrote:
> I've started working on a more generic 'solution' to this issue.
> 
> If you look at the demo program "grouptab.exe" you can see one attempt
> to do this. I had a look at this demo again last night, and concluded that
> its overly complex and not very efficient. I'll work out something
> for a future release.

*Shakes head* Derek, I'm sorry; I feel like all I've been doing lately is
giving you more work to do!

Andrew

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

4. RE: win32lib: Tabbing between controls in/not in a group

Derek Parnell wrote:
> 
> I've started working on a more generic 'solution' to this issue. 
> 
> If you look at the demo program "grouptab.exe" you can see one attempt
> to do this. I had a look at this demo again last night, and concluded that
> its overly complex and not very efficient. I'll work out something 
> for a future release.
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> 

This is perhaps a retarded question, but I peeked at the Win32Lib
code for this once and I never understood exactly why Win32Lib is
handling the tabs itself...

Is it just me, or is there a specific reason you are not letting
Windows handle the tabs.  It seems like alot of overhead when
the implementation is already in place.  If you need some help
regarding this, just post again to this thread.  The change
required is actually very minor.


Don Phillips - aka Graebel
     National Instruments
     mailto: eunexus @ yahoo.com

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

5. RE: win32lib: Tabbing between controls in/not in a group

Don wrote:
> 
> Derek Parnell wrote:
> > 
> > I've started working on a more generic 'solution' to this issue. 
> > 
> > If you look at the demo program "grouptab.exe" you can see one attempt
> > to do this. I had a look at this demo again last night, and concluded that
> > its overly complex and not very efficient. I'll work out something 
> > for a future release.
> > 
> > -- 
> > Derek Parnell
> > Melbourne, Australia
> > 
> 
> This is perhaps a retarded question, but I peeked at the Win32Lib
> code for this once and I never understood exactly why Win32Lib is
> handling the tabs itself...

Because when I started working with the library, this code was already
in there and I didn't know any better. 

> Is it just me, or is there a specific reason you are not letting
> Windows handle the tabs. 

Because I didn't know one could!

> It seems like alot of overhead when
> the implementation is already in place.  If you need some help
> regarding this, just post again to this thread.  The change
> required is actually very minor.

Yes, please! *some* help is required. Actually, I've never really bothered
to even look this topic up in the literature because it already
existed in the library I just thought that that's how it done.

-- 
Derek Parnell
Melbourne, Australia

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

6. RE: win32lib: Tabbing between controls in/not in a group

> > This is perhaps a retarded question, but I peeked at the Win32Lib
> > code for this once and I never understood exactly why Win32Lib is
> > handling the tabs itself...
> 
> Because when I started working with the library, this code was already
> in there and I didn't know any better. 

Ahh

> > Is it just me, or is there a specific reason you are not letting
> > Windows handle the tabs. 
> 
> Because I didn't know one could!
> 
> > It seems like alot of overhead when
> > the implementation is already in place.  If you need some help
> > regarding this, just post again to this thread.  The change
> > required is actually very minor.
> 
> Yes, please! *some* help is required. Actually, I've never really bothered
> to even look this topic up in the literature because it already
> existed in the library I just thought that that's how it done.

I just think they did not know how at the time so they worked around it.
Check out the API "IsDialogMessage".  It (of course) is mainly uses for
Dialogs, but adding this to the message loop will fix you up...

Blurb:
IsDialogMessage

Although the IsDialogMessage function is intended for modeless dialog
boxes, you can use it with any window that contains controls, enabling
the windows to provide the same keyboard selection as is used in a dialog
box. 

When IsDialogMessage processes a message, it checks for keyboard messages
and converts them into selection commands for the corresponding dialog
box. For example, the TAB key, when pressed, selects the next control or
group of controls, and the DOWN ARROW key, when pressed, selects the next
control in a group. 

Because the IsDialogMessage function performs all necessary translating
and dispatching of messages, a message processed by IsDialogMessage must
not be passed to the TranslateMessage or DispatchMessage function.


Don Phillips - aka Graebel
     National Instruments
     mailto: eunexus @ yahoo.com

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

7. RE: win32lib: Tabbing between controls in/not in a group

Don wrote:
<snip>
> Blurb:
> IsDialogMessage
> 
> Although the IsDialogMessage function is intended for modeless dialog
> boxes, you can use it with any window that contains controls, enabling
> the windows to provide the same keyboard selection as is used in a dialog
> box.
> 
> When IsDialogMessage processes a message, it checks for keyboard messages
> and converts them into selection commands for the corresponding dialog
> box. For example, the TAB key, when pressed, selects the next control or
> group of controls, and the DOWN ARROW key, when pressed, selects the next
> control in a group.
<snip>

Don, excellent find!  It sounds like a good addition.

Andrew

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

Search



Quick Links

User menu

Not signed in.

Misc Menu