Ejemplo n.º 1
0
char *GUIGetText( gui_window *wnd, gui_ctl_id id )
{
    LONG                length;
    char                *text;
    gui_control_class   control_class;
    HWND                hwnd;
    gui_ctl_idx         choice;

    if( !GUIGetControlClass( wnd, id, &control_class ) ) {
        return( NULL );
    }
    switch( control_class ) {
    case GUI_LISTBOX :
        choice = GUIGetCurrSelect( wnd, id );
        if( choice == -1 ) {
            return( NULL );
        }
        return( GUIGetListItem( wnd, id, choice ) );
    default :
        hwnd = _wpi_getdlgitem( wnd->hwnd, id );
        if( hwnd == NULLHANDLE ) {
            return( NULL );
        }
        length = _wpi_getwindowtextlength( hwnd );
        if( length > 0 ) {
            text = (char *)GUIMemAlloc( length + 1 );
            if( text != NULL ) {
                _wpi_getwindowtext( hwnd, (LPSTR)text, length + 1 );
                switch( control_class ) {
                case GUI_PUSH_BUTTON:
                case GUI_DEFPUSH_BUTTON:
                case GUI_RADIO_BUTTON:
                case GUI_CHECK_BOX:
                case GUI_STATIC:
                case GUI_GROUPBOX:
                    _wpi_menutext2win( text );
                    break;
                }
            }
            return( text );
        }
        return( NULL );
    }
}
Ejemplo n.º 2
0
bool GUIDropDown( gui_window *wnd, unsigned id, bool drop )
{
    gui_control_class control_class;

    if( !GUIGetControlClass( wnd, id, &control_class ) ) {
        return( false );
    }
    switch( control_class ) {
    case GUI_COMBOBOX :
    case GUI_EDIT_COMBOBOX :
        if( !GUISetFocus( wnd, id ) ) {
            return( false );
        }
        return( GUIToControl( wnd, id, CB_SHOWDROPDOWN, (WPI_PARAM1)drop, 0L, NULL ) );
        break;
    default :
        return( false );
    }
}
Ejemplo n.º 3
0
bool GUISetText( gui_window *wnd, gui_ctl_id id, const char *text )
{
    char                *new_text;
    gui_control_class   control_class;

    if( !GUIGetControlClass( wnd, id, &control_class ) ) {
        return( false );
    }
    if( control_class != GUI_EDIT ) {
        new_text = _wpi_menutext2pm( text );
        _wpi_setdlgitemtext( wnd->hwnd, id, new_text );
        if( new_text ) {
            _wpi_freemenutext( new_text );
        }
    } else {
        _wpi_setdlgitemtext( wnd->hwnd, id, text );
    }
    return( true );
}