Hola Impadron.
No he usado los BalloonTip ni en Delphi ni en Builder C++. La primera traducción que intenté no me resultó:
Código:
typedef struct tagEDITBALLOONTIP {
DWORD cbStruct;
LPCWSTR pszTitle;
LPCWSTR pszText;
INT ttiIcon;
} EDITBALLOONTIP, *PEDITBALLOONTIP;
void __fastcall TForm1::Button1Click(TObject *Sender) {
EDITBALLOONTIP ebt;
ebt.cbStruct = sizeof(EDITBALLOONTIP);
ebt.pszTitle = (wchar_t *)"B es mayor que C";
ebt.pszText = (wchar_t *)"TODO: EXPLICAR POR QUE B NO PUEDE SER MAYOR QUE C";
ebt.ttiIcon = TTI_INFO;
SendMessage(Edit1->Handle, EM_SHOWBALLOONTIP, 0, (LPARAM) &ebt);
}
Sin embargo, de este modo logré el efecto:
Código:
void ShowBalloonTip(TWinControl *Control,int Icon, char *Title, char *Text,
TColor BackColor, TColor TextColor) {
HWND hWndTip;
TOOLINFO ti;
HWND hWnd;
TPoint p;
p.x = Control->Left + Control->Width - 5;
p.y = Control->Top + 5;
Mouse->CursorPos = Control->Parent->ClientToScreen(p);
hWnd = Control->Handle;
hWndTip = CreateWindow(TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX |
TTS_BALLOON | TTS_ALWAYSTIP, 0, 0, 0, 0, hWnd, 0, HInstance, NULL);
if( hWndTip ) {
SetWindowPos(hWndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE |
SWP_NOMOVE | SWP_NOSIZE);
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_CENTERTIP | TTF_TRANSPARENT | TTF_SUBCLASS;
ti.hwnd = hWnd;
ti.lpszText = Text;
GetClientRect(hWnd, &ti.rect);
SendMessage(hWndTip, TTM_SETTIPBKCOLOR, BackColor, 0);
SendMessage(hWndTip, TTM_SETTIPTEXTCOLOR, TextColor, 0);
SendMessage(hWndTip, TTM_ADDTOOL, 1, (int) &ti);
SendMessage(hWndTip, TTM_SETTITLE, Icon % 4, (int)Title);
}
}
void __fastcall TForm1::Edit1KeyPress(TObject *Sender, char &Key) {
if (Key < '0' || Key > '5') { // evaluación trivial
ShowBalloonTip(Edit1, 1, "ERROR", "Sólo números del 0 al 5", clYellow, clBlack);
Key = 0;
}
}
...
Aunque dada mi inexperiencia con los BalloonTip, seguramente te darán una mejor propuesta.
Saludos.