std::string pyGUIControlTextBox::GetText()
{
    char *temp = hsWStringToString(GetTextW().c_str());
    std::string retVal = temp;
    delete [] temp;
    return retVal;
}
Esempio n. 2
0
SIZE GetIdealSize(EditCtrl *w) {
    // force sending WM_NCCALCSIZE
    SetWindowPos(w->hwnd, nullptr, 0, 0, 0, 0,
                 SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE);
    WCHAR *txt = GetTextW(w);
    if (str::Len(txt) == 0) {
        free(txt);
        txt = str::Dup(L"Sample");
    }
    SizeI s = TextSizeInHwnd(w->hwnd, txt);
    free(txt);
    SIZE res;
    res.cx = s.dx + w->ncDx;
    res.cy = s.dy + w->ncDy;

    if (w->hasBorder) {
        res.cx += 4;
        res.cy += 4;
    }

    return res;
}
Esempio n. 3
0
// caller must free() the result
char *GetText(EditCtrl *w) {
    ScopedMem<WCHAR> su(GetTextW(w));
    return str::conv::ToUtf8(su.Get());
}