Support Forums > Other Software and Code

Tab controls and chid forms and richtext (oh my!)

(1/3) > >>

James Conforti:
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!)


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.



Paul Squires:
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?

James Conforti:
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.

Paul Squires:
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.


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

Maybe you've already tried that combination.

James Conforti:
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.


[0] Message Index

[#] Next page

Go to full version