Re: [gtk-list] Re: Q: automatic function on program startup
- From: Eduardo Perez <eduperez redestb es>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Q: automatic function on program startup
- Date: Mon, 08 Dec 1997 14:26:39 +0100
csmall@scooter.o.i.net wrote:
>
> Eduardo Perez wrote:
> > I need to write a program which shows a window when starting and then
> > enters a function (that displays some info in that window), without any
> > user interaction. Could anybody tell me if is this possible and how,
> > please?
> ok you need to be a bit more specific. I assume you know how to make a window,
> you could then use, say, a label in the window:
>
> GtkWidget *mylabel;
>
> void myfunc(void)
> {
> gtk_label_set(GTK_LABEL(mylabel), "Goodbye");
> }
>
> void setup_window() {
> GtkWidget *dialog;
>
> dialog = gtk_dialog_new();
>
> mylabel = gtk_label_new("hello");
> gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), mylabel);
> gtk_widget_show(mylabel);
> gtk_widget_show(dialog);
>
> myfunc();
> }
>
> Now this assumes you want to build your window (I'm using a dialog here)
> and then immediately run the function to put some text in. But of course
> you could wait for:
>
> * A button to be pressed, using gtk_signal_connect to call myfunc();
> * Some time to elapse, using gtk_timeout_add();
> * Some input to occur, or a connection to be made, using gdk_input_add();
> * Plus plenty of other triggers out there.
>
> I must admit, to move from a procedural language to a event-driven one is a
> bit tricky to do, I still get caught, especially with file and socket handling
> stuff.
>
> Hope this helps,
>
> - Craig
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
My problem is that I need this to be done at the very beginning of a
program (not when creating a second window, but the frist one) and the
text shown in the label should change (and be seen) several times.
Once I call gtk_main, only user interaction can trigger a funcion (I
tried using an idle function too, but display isn't redrawn until it
finished), and nothing is displayed before the call to gtk_main.
Thank you very much for your interest, I hope this helps you to help me.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]