I need a self-dimensioning TEXT widget.
I tried in this way:
C
static void cbResizableText(WM_MESSAGE * pMsg)
{
WM_HWIN hWin;
hWin = pMsg->hWin;
switch (pMsg->MsgId)
{
case WM_PRE_PAINT:
{
const GUI_FONT * pFont;
char Str[20];
TEXT_GetText(hWin, Str, 20);
pFont = GUI_SetFont(TEXT_GetFont(pMsg->hWin));
int x = GUI_GetStringDistX(Str) + 3;
WM_SetXSize(hWin, x);
GUI_SetFont(pFont);
}
break;
}
TEXT_Callback(pMsg);
}
static TEXT_Handle RESIZABLETEXTWIDGET_Create(int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags)
{
TEXT_Handle hWin;
hWin = TEXT_CreateEx(x0, y0, xSize, ySize,
hParent, WinFlags | WM_CF_MEMDEV, TEXT_CF_VCENTER | TEXT_CF_HCENTER, GUI_ID_TEXT0, "" );
WM_SetCallback(hWin, cbResizableText);
return hWin;
}
Display More
unfortunately this doesn't work: It seems that there is a clip rectangle that is as large as the size with which the widget was created the first time.
where am I wrong?
Is there a way to be notified of changing the text string?
best regards
Max