Re: Gtk+ and Windows



Thank you all for your support.

I think I'll try the solution to provide winMain instead of main. This sounds a 
good solution, however it will work only for Windows, so I may adopt one other 
solution your provided: calling main et winMain depending of Windows presence 
or not.

I'll tell you how it works.


Now, i've got a second point: this may be a Bug inside gtk+ 2.0 for Windows:
in using notebook:
adding a page, then showing it again provokes the notebook unuseable (we can't 
switch from pages thenafter).

Here is the function:

void on_conf_sim_courant( gpointer user_data, GtkButton *button)
{
        GtkWidget *radio= lookup_widget( GTK_WIDGET( 
user_data), "label_usm_dispo");

        GtkWidget *nb= lookup_widget( GTK_WIDGET( 
dialog_choix_sim), "notebook2");
        if( !nb || !radio){
                printf( "erreur.");
                return;
        }

        if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button))){
                gtk_widget_set_sensitive( GTK_WIDGET( radio), FALSE);

                // disabling the tabs provokes a BUG: when re-enabling it, we 
could not
                // switch from pages of the notebook anymore. So, we only 
disable what's in
                // the page. We could even switch the pages, but unneeded are 
disabled.
                //gtk_notebook_set_show_tabs( GTK_NOTEBOOK( nb), FALSE);
                gtk_widget_set_sensitive( GTK_WIDGET( gtk_notebook_get_nth_page
( GTK_NOTEBOOK( nb), 1)), FALSE);
        }

}


what's commented provokes what I think is a bug.

does anybody here know some about that ?

Fratt


Selon Tor Lillqvist <tml iki fi>:

inra tuxfamily org writes:
 > I'd like to know how to make a windows application so that console
 > DOS mode is avoided.

(A Windows console window has nothing to do with DOS.)

 > For the moment, it craches when linking.  It's may be due to the
 > fact that I don't provide any winMain function (the general way to
 > do windows apps), but this may not be the case.

Tell Visual C++ to build a GUI application, *do* provide a WinMain()
function, and in your WinMain(), do whatever you would have done in
the main() function. (Especially, for a GTK program, *don't* do any of
the generic Windows application stuff like creating windows or having
a Windows message loop. GTK handles all that.) If you need to access
the command line (argc and argv), include <stdlib.h> and use the
global variables __argc and __argv.

You probably should also tell Visual C++ to use the msvcrt runtime. I
think the IDEcalls it "multi-threaded dynamic C library" or something
like that. (Don't be afraid of the word "multi-threaded", this C
runtime is the preferred one to use also from single-threaded
programs.)

--tml









[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]