• Welcome to PlanetSquires Forums.
 

Keeping TAB sequence on one CHILD form

Started by Petrus Vorster, June 24, 2018, 05:50:52 AM

Previous topic - Next topic

Petrus Vorster

HI all

I am fiddling with an old program which uses Child Forms and Tab Control on some of those Child forms.
I want the user to TAB between the different controls on the current form, but the tab "leaves" the form and tabs right through all the other forms before it comes back to the first control on the form.
[On TAB Pages & Child forms, the TAB sequence follows the normal TAB process, but then it moves to the other child forms and follow the TAB sequence on them first, and then return to your first Tab item on your current form]
Can one bind the tab sequence to s specific number of controls on a form? E.g. the Text boxes and the buttons only?
With Child forms this messes around very much.

Thanks - Peter

-Regards
Peter

Eddy Van Esch

Have you tried playing with "Tab Order"?
Right-click on a form --> Form Properties --> Tab Order

Enable / disable tab on controls and change the tab order of the controls ...

Eddy

Petrus Vorster

Hi Eddy

Tab order works fine on normal forms, but on Tab forms and Child forms it has a different sequence.
If first follows the Tab sequence for the current form, but once it passes the last control it does NOt return to the first item as usual.
It then goes to the other child forms or tab pages and follow through the sequence there before it comes back to the current form.

The order works fine, but like i mentioned i want to "lock" the sequence on the current form as is the usual case with normal forms.
I find it difficult to think of some code i can write to keep the sequence to the current child form.

-Thanks

Peter
-Regards
Peter

Petrus Vorster

My explanation reads unclear.

I use the normal Tab editor on all the forms.
Enabling and disabling tab for certain controls.

Normally, on a normal form, Tab starts at the first control you set and then tabs through, setting the focus until you reach the last items in your queue.
Then it simply goes back to the first control, creating a visual "loop or circle" when you press TAB or Shift-tab.

However, if one uses Child Forms of Tab Controls with child forms the whole story changes.
The program still follows your Tab sequence as set, BUT it will loop through ALL the child forms as ONE BIG continuous circle and finally after tabbing through 20 odd forms and all their controls, it finally comes back to the first control.

This is very annoying, but i still cannot figure out something i can do to manually control that process which i understand is just how Windows does it.

Hope this is more clear now.
-Regards
Peter

Eddy Van Esch

Petrus,
Your question was clear to me in your first post ...  :)
Maybe there is some programmatical way to influence the tab sequence. There must be ..
But I can't help you with that ...

Maybe WS_GROUP or something ...?
Eddy

Petrus Vorster

Hi Eddy

Thanks my good man, appreciate the input!

I really need the user to work with the Keyboard for speed sake.
I never finished this project because of the Tab issue bugging me.
[It's the only one I ever made with this child-forms, hence i never got over this tab going all over the place.]

There has to be a way one can temporarily "deactivate" the hidden child forms so they cannot get the tab focus in the background.
i will give Paul a shout, i know he worked with this Child-forms.

-Peter
-Regards
Peter

Petrus Vorster

You see, all this program does is using child forms like you would use a tabcontrol.
It aligns the child form within the parameters of the Frame on page 1.
Then it creates a "ONE PAGE" program although it simply draw the one from on top of another and hides (not close) the others in the background.
This does give a visual appearance of one drawing controls on the main form while you are actually drawing them one on top of another and sizing them within the Frame.

This then unfortunately creates the problem with the TAB sequence jumping forms.
Example 1 is with Mainform, displaying form SMSNOTICE
Example 2 is Mainform, Displaying Form Settings

There will be many others, eventually.

Seems i creates a Pickle for myself.
-Regards
Peter

José Roca

> Then it creates a "ONE PAGE" program although it simply draw the one from on top of another and hides (not close) the others in the background.

Hiding is not enough. You need to disable them too.

Klaas Holland

How about this when you leave the the last TAB-stop on that Form?

'----------------------------------------------------------------------------------------------------
Function FORM1_TEXT3_EN_KILLFOCUS ( ControlIndex   As Long,       _                 ' index in Control Array
                                                              hWndForm       As Dword,   _                 ' handle of Form
                                                              hWndControl    As Dword,   _                 ' handle of Control
                                                              idTextControl    As Long      ) As Long     ' identifier of text control
                                   
    FF_Control_SetFocus HWND_FORM1_TEXT1

End Function

Petrus Vorster

Hi All

Yes, Josè that makes sense. It just hides the others and not disable them.
It then creates obviously one big page program.

Thanks everyone.
-Regards
Peter

Petrus Vorster

Klaas, i also went that way on the killfocus at first on the last control, but then it messes around on shift-tab when the use wants to go backwards.

I think the secret lies in just having a control code for enabling and hiding + disabling hidden forms.
the visual effect is very cool, but it does bring along its own challenges.

-Thanks all for the input.
-Regards
Peter

Paul Squires

Hi Peter,

I am replying here so that others can benefit from the answer. Based on the code that you sent to me privately, I could easily see that you are not "hiding" a form with the definition that myself or others are intending. Your code seems to be simply hiding the form by setting the size of it to 0 height and 0 width.

Your current code:
FF_Control_SetSize(hwnd_settings,0,0)

A better approach:
FF_Control_ShowState(hwnd_settings,%SW_HIDE)

And then to subsequently show the form:
FF_Control_ShowState(hwnd_settings,%SW_SHOW)

If that does not work... as Jose has pointed out you may need to disable the hidden form as well. This is easily done with the following functions:
FF_Control_Disable(hwnd_settings)
FF_Control_Enable(hwnd_settings)

So the sequence could be...
(1) Hide the non-active forms
FF_Control_ShowState(hwnd_settings,%SW_HIDE)
FF_Control_Disable(hwnd_settings)

(2) Show the current active forms
FF_Control_ShowState(hwnd_settings,%SW_SHOW)
FF_Control_Enable(hwnd_settings)

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

> Your code seems to be simply hiding the form by setting the size of it to 0 height and 0 width.

That explains it. Hiding the child dialogs should be enough. I suggested to disable them because he said that "hiding" was not working. In my "tab" code for the Cwindow class I simply use ShowWindow with SW_SHOW and SW_HIDE.


Paul Squires

Quote from: José Roca on June 26, 2018, 07:31:26 PM
> Your code seems to be simply hiding the form by setting the size of it to 0 height and 0 width.

That explains it. Hiding the child dialogs should be enough. I suggested to disable them because he said that "hiding" was not working. In my "tab" code for the Cwindow class I simply use ShowWindow with SW_SHOW and SW_HIDE.

...and with FireFly's generated code for switching between child pages in a Tab Control, I do the same thing.... simply show/hide the pages.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Using FireFly again just reminded me and reinforced just how ugly it is on high dpi monitors. My system is running a display at 3840 x 2160 and that shows FireFly's glaring lack of proper high dpi support.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer