PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Petrus Vorster on June 24, 2018, 05:50:52 AM

Title: Keeping TAB sequence on one CHILD form
Post by: Petrus Vorster on June 24, 2018, 05:50:52 AM
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

Title: Re: Keeping TAB sequence on one form
Post by: Eddy Van Esch on June 24, 2018, 05:56:57 AM
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 ...

Title: Re: Keeping TAB sequence on one form
Post by: Petrus Vorster on June 24, 2018, 07:36:06 AM
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
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Petrus Vorster on June 24, 2018, 07:52:09 AM
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.
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Eddy Van Esch on June 24, 2018, 08:40:58 AM
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 ...?
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Petrus Vorster on June 24, 2018, 12:05:09 PM
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
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Petrus Vorster on June 24, 2018, 12:11:38 PM
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.
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Josť Roca on June 24, 2018, 01:19:35 PM
> 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.
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Klaas Holland on June 25, 2018, 03:54:58 AM
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
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Petrus Vorster on June 26, 2018, 04:42:39 PM
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.
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Petrus Vorster on June 26, 2018, 04:49:20 PM
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.
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Paul Squires on June 26, 2018, 07:12:41 PM
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)

Title: Re: Keeping TAB sequence on one CHILD form
Post by: 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.

Title: Re: Keeping TAB sequence on one CHILD form
Post by: Paul Squires on June 26, 2018, 08:14:49 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.
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Paul Squires on June 26, 2018, 09:12:40 PM
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.
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Josť Roca on June 26, 2018, 09:42:32 PM
Now you know why I insisted so much about the subject. Some PBer's that have begin to use 4K monitors are now looking for my posts about DPI.
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Paul Squires on June 26, 2018, 09:47:43 PM
Now you know why I insisted so much about the subject. Some PBer's that have begin to use 4K monitors are now looking for my posts about DPI.

You're a man who's ahead of his time  :D
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Petrus Vorster on June 27, 2018, 03:09:55 PM
Hey guys, its always good to ask here.
Thanks for the help, busy making the changes!

And as soon as the Firefly for Freebasic is there, i will most definitely enjoy using your high dpi controls!!

Thanks a million.

-Peter
Title: Re: Keeping TAB sequence on one CHILD form
Post by: Petrus Vorster on June 27, 2018, 03:42:33 PM
Yes, a simple FF_control_disable on the forms hiding and a simple FF_control_enable on the form you see keeps the Tab sequence nicely on one form.

Seems logical now.... :-[

thanks for the advice.