PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Tab controls and chid forms and richtext (oh my!)  (Read 619 times)

James Conforti

  • Little Newbie
  • *
  • Posts: 12
  • FF3 User
Tab controls and chid forms and richtext (oh my!)
« on: July 15, 2019, 02:05:57 AM »

Hi guys...

Having slayed the richtext control dragon with my own simple library... I come upon this strange problem

Imagine a tab control with two tabs "Results" and "Log".

Each has a child form.

Each child form has a (as in one, single) control.

On the Results tab, the form contains a richtext control (I can print to it nicely with all sorts of cool fonts/colors/etc)

On the Log tab, the form contains listview control (which I use as a running log - yes, a kludge but it works!)

The PROBLEM..

If the LOG tab is selected/active and I print to the richtext control, I have to select back and forth to ever see the richtext.

Then it appears in all it's glory.

I've tried setfocus, set selected tab, various combinations - but the fact remains that if the user has the LOG tab selected when RESULTS come in, he won't see them.

Ideas?

Paul?
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8937
  • Windows 10
    • PlanetSquires Software
Re: Tab controls and chid forms and richtext (oh my!)
« Reply #1 on: July 15, 2019, 08:11:12 AM »

If I understand correctly:

- The LOG tab is active (the one with the Listview)
- You initiate a "Print" function (presumably from a menu item or hotkey)
- When you start the print process you want to programmically change the tab to the Results tab?

This is the part that is not clear to me:
"I have to select back and forth to ever see the richtext."

Do you mean that the first time that you switch to the RichEdit that the actual text is not visible? A repainting issue? A control not visible issue?
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

James Conforti

  • Little Newbie
  • *
  • Posts: 12
  • FF3 User
Re: Tab controls and chid forms and richtext (oh my!)
« Reply #2 on: July 15, 2019, 09:30:14 AM »

I'll try to be clearer.

If the log tab is selected.  The log form is visible, the listview control on the form on the log tab is visible....

And you print to the richtext control which is on the richtext form that is attached to the results tab that is not selected... you don't see the text.  If you select the richtext connected tab via program you don't see the text.  To see the text you have to select (with the mouse).

The richtext tab, then the log/listview tab, then the richefit  tab again and there is your beautiful richtext.

If, of course, the results tab/richtext form/richtext control is first and foremost WHEN text is sent to the richtext control. (and by this I mean my manual selection with the mouse)

All is well.

And yes, it "seems like" that the form with the richtext control isn't just "coming to the top" (visible). When that tab is selected programmatically.

I've tried select tab. (Which selects it but doesn't bring the right form to the surface).  I've tried giving the tab focus.  Repainting.

I guess the simplest way to put it is this:

Tab 2 selected.

Do something on (form attached to) tab 1

The only way to get that to appear is when there is a manual change from 2 to 1.

There is no way I've found programming that does *exactly*what FF3 does when changing tabs.

Obviously it's hiding one form and making the other visible (I think)...

Does that make it clearer?

1) Right tab selected - print stuff - success
2) Wrong tab selected - what is needed programatically to "select": the proper tab AND have the right form come to the top in all its Glory.  In other words, to do exactly what a manual mouse click does in selecting right tab from wrong tab.

Simple selecting the active tab or focus or whatever doesn't do it.
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8937
  • Windows 10
    • PlanetSquires Software
Re: Tab controls and chid forms and richtext (oh my!)
« Reply #3 on: July 15, 2019, 11:57:42 AM »

Sorry I am not at my development computer right now but a few searches of the forum seems to indicate that maybe the following sequence of function calls should do the job. Please let me know if it does.

  FF_TABCONTROL_SETTABFOCUS (HWND_MAINFORM_MAINTAB, TabNumber)
  FF_TABCONTROL_SETSELECTEDTAB (HWND_MAINFORM_MAINTAB, Tabnumber)

Obviously change the HWND_MAINFORM_MAINTAB and TabNumber to the values relevant to your program.

Maybe you've already tried that combination.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

James Conforti

  • Little Newbie
  • *
  • Posts: 12
  • FF3 User
Re: Tab controls and chid forms and richtext (oh my!)
« Reply #4 on: July 15, 2019, 04:19:40 PM »

Yes sir, I've tried both of those in various combinations

No joy.  I think they don't force the FORM to the front.

(And sadly, I don't know how).

Using those is somehow different than physically clicking the tab.
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8937
  • Windows 10
    • PlanetSquires Software
Re: Tab controls and chid forms and richtext (oh my!)
« Reply #5 on: July 15, 2019, 05:03:41 PM »

If you're able to send me the project then I can try to decipher where the problem is (or at least the CODEGEN*.* files). Maybe somewhere else in the code the tab focus is being stolen back to the original form. Hard to know.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

James Conforti

  • Little Newbie
  • *
  • Posts: 12
  • FF3 User
Re: Tab controls and chid forms and richtext (oh my!)
« Reply #6 on: July 16, 2019, 12:27:40 AM »

Paul.

First, many many thanks for your help.  I realize that FF for PB is sort of on the shelf with PB essentially static/deprecated so your continued help is, well.. just thanks!

(PB is what I know, what I've written almost 100 libraries in, etc - so I'm stuck with it until 32 bit programs stop running - or I have time to learn something else (aka the 12th of never)

I created a mini project that does the EXACT thing.

The "actual" project is rather large and uses crypto hardware/etc so not feasible to share it.  it wouldn't run.

So I whipped this up.

All you have to do is

1: Run executable
2: Select "Log" tab
3: Press "Command1".

You'll see the "focus" change back to "results" but you won't see the richtext.

You have to then click "Log" and then "Results" again to see the results.

Maybe I'm dense - I never assume I'm not. haha.
Logged

David Kenny

  • Senior Member
  • ***
  • Posts: 457
  • Windows 7 & 10
Re: Tab controls and chid forms and richtext (oh my!)
« Reply #7 on: July 16, 2019, 06:16:31 AM »

James,

I commented out one line in the DisplayFakeRTF routine and added one below it.  I think it now works as you stated it should.  Here are the two lines:
Code: [Select]
' APP_SET_RTF_FOCUS
  FF_TabControl_SetTabFocus( HWND_FRMMAIN_TABCONTROL1, 0 )

You can probably delete the APP_SET_RTF_FOCUS sub.

David
Logged

James Conforti

  • Little Newbie
  • *
  • Posts: 12
  • FF3 User
Re: Tab controls and chid forms and richtext (oh my!)
« Reply #8 on: July 16, 2019, 07:19:57 AM »

Thanks David.  Now I could SWEAR I tried this at one point, and it didn't work.

Hence the bunch of "tried" and commented out routines.

I modified the routines thusly in the "test" program and it seemed to work...

(which is essentially exactly what you did, just a few subroutines deeper)

Code: [Select]
Sub SetTabFocus(MyTabNum As Dword)

    Select Case MyTabNum
        Case %TAB_RESULTS
            FF_TabControl_SetTabFocus( HWND_FRMMAIN_TABCONTROL1, 0 )
        Case %TAB_LOG
            FF_TabControl_SetTabFocus( HWND_FRMMAIN_TABCONTROL1, 1 )
    End Select
   
End Sub

Sub APP_SET_RTF_FOCUS

    Call SetTabFocus(%TAB_RESULTS)
   
End Sub
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8937
  • Windows 10
    • PlanetSquires Software
Re: Tab controls and chid forms and richtext (oh my!)
« Reply #9 on: July 16, 2019, 07:50:16 AM »

Excellent - happy that a solution was found - thanks David for looking at this. You found the solution before I even had a chance to download the sample project. :)
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

David Kenny

  • Senior Member
  • ***
  • Posts: 457
  • Windows 7 & 10
Re: Tab controls and chid forms and richtext (oh my!)
« Reply #10 on: July 16, 2019, 07:57:24 AM »

You're both welcome, just happened to be up late and bored.
Logged