Re: Waiting for user input



On Thu, 17 Aug 2000, Salvador Ramirez wrote:
 Hi, 

> Hi,
> 
>   I'm trying to do a function that display a window with a clist and an
> entry and a "OK" button.
> I would like that this function wait for the user input (the selection
> of an item on the clist, some text on the text entry and the push over
> the OK button) and then return, however I think this is not possible
> because gtk+ works with the callbacks model so I would have to connect a
> signal to the OK button then read the selection and the text on the text
> entry and make something with that
> data. I have been working this way but now I am needing this same
> selection window to do other thing with the data selected on the clist
> and the text on text entry so I would not like to create another
> function similar to the previous but just changing the data processing
> but I would like to
> create a function that create the user interface and then I could get
> the data selected and entered by the user so I could use that
> information anywhere on the program. So my question is how can I create
> a function like this? I thought to connect the OK button to some
> function that put on some global variables the user input (either from
> the clist and the text entry) and then read that global variables but
> can't figure out how to make gtk wait for the press on the OK button to
> then follow with the reading of the variables.. 

 Just call gtk_main() right after showing the window, and make your OK-button
call gtk_main_quit() in the clicked signal - this way you will be able to wait
for window to be filled since it will look to you as that gtk_main()
called after gtk_widget_show_all was returned. That's it.

> Thanks,
> 
> ---sram

 Best regards,
  -Vlad






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