Hola.
Cita:
Empezado por aguml
Por cierto, esto que haces:
Código PHP:
(LPARAM)(pt.y * 65535 + pt.x)
Viene a ser lo mismo que hacer esto ¿no?:
Código PHP:
(LPARAM)MAKELONG(pt.x, pt.y)
|
Si, es equivalente.
Cita:
Por cierto en tu ejemplo saldría para todos los combobox del form pero en mi caso tengo dos forms y solo quiero ese comportamiento en uno por lo que supongo que teniendo el hWnd puedo obtener el nombre o el número de instancia para saber cual es ¿no?
|
Se me ocurre que una forma sencilla de discriminarlo podría ser:
.h
Código PHP:
class TForm1 : public TForm
{
__published:
...
private:
bool FInCBox1;
void __fastcall AppIdle(TObject *Sender, bool &done);
...
.cpp
Código PHP:
...
TStrings* ListaHints;
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Application->OnIdle = AppIdle;
...
FInCBox1 = false;
ListaHints = new TStringList;
ListaHints->Assign(ComboBox1->Items);
}
void __fastcall TForm1::AppIdle(TObject *Sender, bool &done)
{
TPoint pt;
HWND HWL;
GetCursorPos( &pt );
HWL = WindowFromPoint( pt );
if ( HWL != 0 )
{
StatusBar1->SimpleText = "";
char buff[128];
GetClassName( HWL, buff, sizeof( buff ) );
if ( StrIComp( buff, "ComboLBox" ) == 0)
{
if ( FInCBox1)
{
::ScreenToClient( HWL, &pt );
int inx = LOWORD( SendMessage( HWL, LB_ITEMFROMPOINT, 0,
(LPARAM)(pt.y * 65535 + pt.x) ) );
if ( inx >= 0 )
StatusBar1->SimpleText = ListaHints->Strings[inx];
}
}
}
}
void __fastcall TForm1::ComboBox1DropDown(TObject *Sender)
{
FInCBox1 = true;
}
void __fastcall TForm1::ComboBox1CloseUp(TObject *Sender)
{
FInCBox1 = false;
}
...
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete ListaHints;
}
Cita:
La StatusBar la tengo de forma que muestra los hint de todos los componentes al ponerse encima así que creo que con cambiar el hint me valdría ¿no?
|
Si.
Saludos