Board index » cppbuilder » TTabSet Bug?

TTabSet Bug?


2003-11-09 04:26:01 AM
cppbuilder66
I have a TTabSet in a MDI Form, which is populated by any mdi child that is
created (each tab corrasponds t oa mdi child form.)
I have a OnChange handler for the TTabSet (WinList) as follows:
// -------------------------------------------------------------------
void __fastcall TDCSRForm::WinListClick(TObject *Sender)
{
TPoint P(WinList->ScreenToClient(Mouse->CursorPos));
if (WinList->ItemAtPos(P) != -1) {
String TabTitle = WinList->Tabs->Strings[WinList->ItemAtPos(P)];
Caption = "(" + TabTitle + ") (" +
DCSRWindowList[TabTitle]->Caption + ")"; // DEBUG
DCSRWindowList[TabTitle]->Perform(WM_SYSCOMMAND, SC_RESTORE, 0);
}
}
// -------------------------------------------------------------------
(FYI: DCSRWindowList is a <map>of my MDI Child base form that I derive all
my MDI childs from, in the map that are referenced by a String for a key.
The text of the tab matches the entry in the map.)
Heres the strange part:
A minimized MDI Child will restore if I RIGHT click, but if I LEFT click, it
refuses to restore. I even tried putting a break point on the line with
Perform in it, and it breaks there on LEFT and RIGHT clicks, but only
actually restores apon RIGHT. I even tried using MouseDown/Up handlers
instead. Same result. The Perform works for R but not L clicks.
Anyone seen this before???
Is this a bug in TTabSet? Or in VCL/BCB somewhere?
It's as if the perform message is never sent if I left click the tab for a
minimized child, yet the caption show matching captions; if the child's
caption is "Test123", then it says "(Test123) (Test123)", so I know the
right form is being referenced.
Thanks for any insight. This has had me boggled for about a week. Google
Groups, which is usually a great help, yielded very little on this matter.
--
Stan
 
 

Re:TTabSet Bug?

Forgot to mention I'm using BCB5.
--
Stan
"SR" < XXXX@XXXXX.COM >wrote in message
Quote
I have a TTabSet in a MDI Form, which is populated by any mdi child that
is
created (each tab corrasponds t oa mdi child form.)

I have a OnChange handler for the TTabSet (WinList) as follows:

// -------------------------------------------------------------------

void __fastcall TDCSRForm::WinListClick(TObject *Sender)
{
TPoint P(WinList->ScreenToClient(Mouse->CursorPos));

if (WinList->ItemAtPos(P) != -1) {
String TabTitle = WinList->Tabs->Strings[WinList->ItemAtPos(P)];

Caption = "(" + TabTitle + ") (" +
DCSRWindowList[TabTitle]->Caption + ")"; // DEBUG

DCSRWindowList[TabTitle]->Perform(WM_SYSCOMMAND, SC_RESTORE, 0);
}
}
// -------------------------------------------------------------------

(FYI: DCSRWindowList is a <map>of my MDI Child base form that I derive
all
my MDI childs from, in the map that are referenced by a String for a key.
The text of the tab matches the entry in the map.)

Heres the strange part:

A minimized MDI Child will restore if I RIGHT click, but if I LEFT click,
it
refuses to restore. I even tried putting a break point on the line with
Perform in it, and it breaks there on LEFT and RIGHT clicks, but only
actually restores apon RIGHT. I even tried using MouseDown/Up handlers
instead. Same result. The Perform works for R but not L clicks.

Anyone seen this before???

Is this a bug in TTabSet? Or in VCL/BCB somewhere?

It's as if the perform message is never sent if I left click the tab for a
minimized child, yet the caption show matching captions; if the child's
caption is "Test123", then it says "(Test123) (Test123)", so I know the
right form is being referenced.

Thanks for any insight. This has had me boggled for about a week. Google
Groups, which is usually a great help, yielded very little on this matter.

--
Stan


 

Re:TTabSet Bug?

"SR" < XXXX@XXXXX.COM >wrote in message
Quote
I have a TTabSet in a MDI Form, which is populated by any mdi child that
is
created (each tab corrasponds t oa mdi child form.)

What exactly is the relationship between the TTabSet and the MDI child
forms? Are the MDI forms embedded on the TTabSet, or are you using the
TTabSet solely as a means to minimize/maximize the MDI form(s) when their
associated tabs are clicked?
- Dennis
 

{smallsort}

Re:TTabSet Bug?

Dennis Jones wrote:
Quote
"SR" < XXXX@XXXXX.COM >wrote in message
news:3fad515a$ XXXX@XXXXX.COM ...
>I have a TTabSet in a MDI Form, which is populated by any mdi child
>that is created (each tab corrasponds t oa mdi child form.)
>

What exactly is the relationship between the TTabSet and the MDI child
forms? Are the MDI forms embedded on the TTabSet, or are you using
the TTabSet solely as a means to minimize/maximize the MDI form(s)
when their associated tabs are clicked?

- Dennis
The TTabSet sits at the bottom of the MDI Main form. When I click a tab,
that MDI child ceems into focus, and likewise, if I focus a child window by
clicking/switching to it by any other means, the matching tab becomes
selected too.
What I am trying to do is 'wake up', if you will, a minimized mdi child when
it's corrasponding tab is clicked. The TTabSet's OnClick handler get called
reguardless the right or left button is used, yet the perform only seems to
work if the Right button is used. (See code in first post.)
I even tried temporarly putting a button on the middle of the main form and
putting the Perform code in it's click handler and that restores the window
just fine, upon a normal left click.
I really can't tell for the life of me why the Perform doesn't work for Left
clicks in a OnClick handler in TTabSet.
--
Stan
 

Re:TTabSet Bug?

"SR" < XXXX@XXXXX.COM >wrote:
Quote
[...] The Perform works for R but not L clicks.
Strange but true. I had the same problem. Oddly enough, if I
put a ShowMessage directly above the Perform, the Perform
functioned correctly. I was able to work around this problem
by using a Timer with the interval set to 100 (1/10 of a
second):
#include "Unit2.h"
//-------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TMain *Main;
TForm* pForm;
TForm2* pForm2;
//-------------------------------------------------------------
__fastcall TMain::TMain(TComponent* Owner) : TForm(Owner)
{
pForm2 = NULL;
}
//-------------------------------------------------------------
void __fastcall TMain::TabSet1Click(TObject *Sender)
{
if( !pForm2 )
{
try
{
pForm2 = new TForm2( this );
}
catch(...)
{
MessageDlg( "Insufficent memory. To continue, quit one or more programs and try again.", mtWarning, TMsgDlgButtons() << mbOK, 0);
}
}
if( pForm2 )
{
pForm = pForm2;
Timer1->Enabled = true;
}
}
//-------------------------------------------------------------
void __fastcall TMain::Timer1Timer(TObject *Sender)
{
Timer1->Enabled = false;
if( pForm->WindowState == wsMinimized )
{
pForm->Perform(WM_SYSCOMMAND, SC_RESTORE, 0);
pForm->BringToFront();
pForm->SetFocus();
}
}
//-------------------------------------------------------------
//-------------------------------------------------------------
//-------------------------------------------------------------
__fastcall TForm2::~TForm2()
{
Main->pForm2 = NULL;
}
//-------------------------------------------------------------
~ JD
 

Re:TTabSet Bug?

JD wrote:
Quote
"SR" < XXXX@XXXXX.COM >wrote:
>[...] The Perform works for R but not L clicks.

Strange but true. I had the same problem. Oddly enough, if I
put a ShowMessage directly above the Perform, the Perform
functioned correctly. I was able to work around this problem
by using a Timer with the interval set to 100 (1/10 of a
second):
But it still really bothers me that it get to the perform line, appears to
call it, but nothign happens. Anyone possibly know what is going on?
--
Stan