Board index » cppbuilder » VCL ComboBox with Hints

VCL ComboBox with Hints


2005-11-08 03:13:26 AM
cppbuilder89
I need generate a VCL ComboBox with whints for every Item in ComboBox, and
the Hint must appear every time I have highlighted one item from ComboBox,
not only when I have selected a Item, it works on ListBox and other
components but not in a ComboBox.
By the way VCL ComboBox componet hasn't a OnHighlighted Event or similar, it
exist only in CLX ComboBoxComponent.
Thanks,
Romuald Lobos
 
 

Re:VCL ComboBox with Hints

There is a method called ItemAtPos for the TListBox component, but doesn't
exist in the Combo Box.
davichu
"romuald" < XXXX@XXXXX.COM >escribi?en el mensaje
Quote
I need generate a VCL ComboBox with whints for every Item in ComboBox, and
the Hint must appear every time I have highlighted one item from ComboBox,
not only when I have selected a Item, it works on ListBox and other
components but not in a ComboBox.

By the way VCL ComboBox componet hasn't a OnHighlighted Event or similar,
it exist only in CLX ComboBoxComponent.

Thanks,

Romuald Lobos


 

Re:VCL ComboBox with Hints

"romuald" < XXXX@XXXXX.COM >wrote in message
Quote
I need generate a VCL ComboBox with whints for every Item in ComboBox, and
the Hint must appear every time I have highlighted one item from ComboBox,
not only when I have selected a Item, it works on ListBox and other
components but not in a ComboBox.
You could fake a combo box by combining an edit box with a button
and popping up a list box when the button etc. is pressed.
That way you would have a hint for each item in the list box.
HTH Pete
 

{smallsort}

Re:VCL ComboBox with Hints

"romuald" < XXXX@XXXXX.COM >wrote:
Quote

[...] the Hint must appear every time I have highlighted one
item from ComboBox,
//-------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
ComboBox1->Style = csOwnerDrawFixed;
}
//-------------------------------------------------------------
void __fastcall TForm1::ComboBox1DrawItem(TWinControl *Control, int Index, TRect &Rect, TOwnerDrawState State)
{
TComboBox *pBox = dynamic_cast<TComboBox*>( Control );
TCanvas *pCanvas = pBox->Canvas;
if( State.Contains(odSelected) )
{
pCanvas->Brush->Color = clHighlight;
pCanvas->Font->Color = clHighlightText;
Hint = ComboBox1->Items->Strings[Index];
}
else
{
pCanvas->Brush->Color = pBox->Color;
pCanvas->Font->Color = pBox->Font->Color;
}
pCanvas->FillRect( Rect );
pCanvas->TextOut( .... );
}
//-------------------------------------------------------------
~ JD