Re: A small doubt....

On Sun, 2003-12-28 at 00:15, Anish Chandran wrote:
> Hi...
>       While i m clicking a button i don't want to go to function.... Rather
> i would to exectue only one line... and so me thing like
> if(gtk_....(button)
> {
>    g_print ("hello");
> }
> i dont want to call a GTK_SIGNAL_FUNC

Generally speaking, this is not a desirable thing to do in any GUI.  In
fact, GUI programming is a dramatically different paradigm than
conventional procedural programming.  When doing GUI programming, you
are not in control of the program flow.  the internal event dispatch
loop is.  Thus, callbacks are the most effect and logical way to deal
with user interface events.  For this reason, what you are trying to do,
although I'm sure possible in GTK, is not the correct thing to do. 
Especially since once you call the main gtk loop, gtk_main, control
never returns to your program, except to respond to events.

> is there any command that will return  TRUE when the signal is emitted some
> thing like that

Sure you could do that.  Just have each call back function set a flag
somewhere to indicate that the event occurred.  The problem is, where
will your code be that checks this flag.  Remember that GTK is in
control; none of your main code is reachable, unless it is a callback. 
Furthermore, if your code is in control, there's no way for GTK events
such as mouse clicks,etc, to even be heard or responded to.  You can't
even draw the gui unless you call gtk_main.

I would seriously suggest that you reconsider the reasons why you
wanting to do this and adapt to work within the event-driven paradigm,
rather than try to fit GUI programming to your procedural model (which
doesn't fit well).  I've visited this territory before, back in the DOS
days when I was doing my own use-interface code.  It never worked well
at all.  I ended up where all GUIs end up: making things event-driven
and yielding control to an event dispatch loop.


> Thank you in advance
> Anish Chandran
> _____________________________________________
> Free email with personality! Over 200 domains!
> Looking for friendships,romance and more?
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org

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