Dear Scuri:

I test below code to try to send key to other dialog,
In Win7, it works good, but in Linux Mint 18.3, the "Send Hello Out" can't
wok,
How should I need modify my code to work in Linux Mint?

extern(C) int button_ACTION( Ihandle* ih )
{
    IupSetFocus( IupGetHandle( "MAIN_DIALOG" ) );
    IupSetFocus( IupGetDialogChild( IupGetHandle( "MAIN_DIALOG" ), "TEXT" )
);
    IupSetGlobal( "KEY", "72" );
    IupSetGlobal( "KEY", "101" );
    IupSetGlobal( "KEY", "108" );
    IupSetGlobal( "KEY", "108" );
    IupSetGlobal( "KEY", "111" );
    IupSetGlobal( "KEY", "33" );

    return IUP_DEFAULT;
}

extern(C) int button1_ACTION( Ihandle* ih )
{
    IupSetFocus( IupGetDialogChild( IupGetHandle( "SUB_DIALOG" ), "TEXT1" )
);
    IupSetGlobal( "KEY", "72" );
    IupSetGlobal( "KEY", "101" );
    IupSetGlobal( "KEY", "108" );
    IupSetGlobal( "KEY", "108" );
    IupSetGlobal( "KEY", "111" );
    IupSetGlobal( "KEY", "33" );

    return IUP_DEFAULT;
}

void main()
{
    IupOpen (null, null );
    Ihandle* mainDlg = IupDialog( null );
    IupSetHandle( "MAIN_DIALOG", mainDlg );

    IupSetAttribute( mainDlg, "TITLE", "Test" );
    IupSetAttribute( mainDlg, "SIZE", "400x300");


    Ihandle* text = IupText( null );
    IupSetAttribute( text, "EXPAND", "YES" );
    IupSetAttribute( text, "NAME", "TEXT" );
    IupSetAttribute( text, "MULTILINE", "YES" );

    Ihandle* vBox = IupVbox( text, null );

    IupAppend( mainDlg, vBox );
    IupShow( mainDlg );

    Ihandle* subDialog = IupDialog( null );
    IupSetAttribute( subDialog, "PARENTDIALOG", "MAIN_DIALOG" );
    IupSetAttributes( subDialog, "SIZE=300x-1" );
    IupSetHandle( "SUB_DIALOG", subDialog );

    Ihandle* button = IupButton( "Send Hello Out!", null );
    IupSetAttribute( button, "SIZE", "100x24" );
    IupSetCallback( button, "ACTION", cast(Icallback) &button_ACTION );

    Ihandle* button1 = IupButton( "Send Hello In!", null );
    IupSetAttribute( button1, "SIZE", "100x24" );
    IupSetCallback( button1, "ACTION", cast(Icallback) &button1_ACTION );


    Ihandle* text1 = IupText( null );
    IupSetAttribute( text1, "EXPAND", "YES" );
    IupSetAttribute( text1, "NAME", "TEXT1" );
    IupSetAttribute( text1, "MULTILINE", "YES" );

    Ihandle* hBox1 = IupHbox( button, button1, null );
    Ihandle* vBox1 = IupVbox( hBox1, text1, null );

    IupAppend( subDialog, vBox1 );

    IupShow( subDialog );


    IupMainLoop();
    IupClose();
}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to