Ron Eggler @ Work wrote:
Quote
Hi,
I got a StringGrid in my Application, and i would like to Show a
ComboBox at the top of the cell, when a cell in col 3 is clicked. i
tried this:
TComboBox *temp_CB=NULL;
if( Reftab_SG->Col != 3)
{
ModeHinweis_Mem->Hide(); // HinweisPanel für Mode verstecken
if (temp_CB)
delete temp_CB; temp_CB=NULL;
}
else
{
ModeHinweis_Mem->Show(); // HinweisPanel für Mode anzeigen
if (lan)
{
[someCode]
}
else
{
[some Code]
}
temp_CB=new TComboBox(Reftab_SG);
temp_CB->Left=200;
temp_CB->Top=200;
temp_CB->Visible=true;
}
but i can't see anything, why?
Thanks!
Ok, got it displayed, but i don't get it hided anymore :( my code now:
TComboBox *temp_CB=NULL;
if( Reftab_SG->Col != 3)
{
ModeHinweis_Mem->Hide(); // HinweisPanel für Mode verstecken
if (temp_CB)
{
temp_CB->Visible=false;
delete temp_CB; temp_CB=NULL;
}
}
else
{
ModeHinweis_Mem->Show(); // HinweisPanel für Mode anzeigen
if (lan)
{
[someCode]
}
else
{
[someCode]
}
temp_CB=new TComboBox(this);
temp_CB->Parent=this;
temp_CB->Style=csDropDownList;
temp_CB->OnChange = temp_CBChange;
temp_CB->Left=Reftab_SG->Left;
temp_CB->Height=Reftab_SG->DefaultRowHeight;
temp_CB->Top=Reftab_SG->Top;
temp_CB->Visible=true;
temp_CB->Items->Add("Bit 1&0: 0=Speedmode, 1=absolute Pos. mode,
2=relative Pos. mode");
temp_CB->Items->Add("Bit 4: 1=Absolute Time(whole mov. Cmd), 0=Time
after mov. Cmd");
temp_CB->Items->Add("Bit 5: 1=Stop after this mov. Cmd, 0=Continue
with next mov. Cmd");
/*** [Code for positioning] ***/
TRect Rect = Reftab_SG->CellRect(Reftab_SG->Col,Reftab_SG->Row);
temp_CB->Top = Reftab_SG->Top;
temp_CB->Left = Reftab_SG->Left;
temp_CB->Text = EmptyStr;
temp_CB->Top = temp_CB->Top + Rect.Top + Reftab_SG->GridLineWidth+72;
temp_CB->Left = temp_CB->Left + Rect.Left +
Reftab_SG->GridLineWidth+8;
temp_CB->Height = (Rect.Bottom - Rect.Top);
temp_CB->Width = (Rect.Right - Rect.Left) + 2;
temp_CB->Visible = true;
temp_CB->SetFocus();
/*** [/Code for positioning] ***/
}
Where is the Error, what do i miss?
Thanks!