comp.lang.ada
 help / color / mirror / Atom feed
* response on OK button
@ 2011-07-09 10:37 ldries46
  2011-07-09 12:14 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 4+ messages in thread
From: ldries46 @ 2011-07-09 10:37 UTC (permalink / raw)


I created a dialog with an OK and a cancel button.
When I call the dialog using Run(dialog) only the quit button of the window 
gives a response. The OK and the Cancel button do not even give any 
response. I found this by using the Debug facility of GPS.

What do I do wrong. I expected the buttons to react with giving the 
gtk_response_OK or _Cancel value retuirned by Run





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: response on OK button
  2011-07-09 10:37 response on OK button ldries46
@ 2011-07-09 12:14 ` Dmitry A. Kazakov
  2011-07-12 10:10   ` ldries46
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry A. Kazakov @ 2011-07-09 12:14 UTC (permalink / raw)


On Sat, 9 Jul 2011 12:37:58 +0200, ldries46 wrote:

> I created a dialog with an OK and a cancel button.
> When I call the dialog using Run(dialog) only the quit button of the window 
> gives a response. The OK and the Cancel button do not even give any 
> response. I found this by using the Debug facility of GPS.
> 
> What do I do wrong.

1. You didn't post the complete code

2. You were running GTK under the debugger, which might lead to
unpredictable results.

> I expected the buttons to react with giving the 
> gtk_response_OK or _Cancel value retuirned by Run

As a general note, when adding buttons to the dialog you have to use
Add_Button, which specifies the response for the button being added.

If you don't do that, simply placing a button into the dialog as a
container, you have to catch the signal emitted by the button and close the
dialog manually from the handler.

Either method works.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: response on OK button
  2011-07-09 12:14 ` Dmitry A. Kazakov
@ 2011-07-12 10:10   ` ldries46
  2011-07-12 15:15     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 4+ messages in thread
From: ldries46 @ 2011-07-12 10:10 UTC (permalink / raw)


Dimitry,

You are correct that I didn't send the complete code. The answer you gave 
solved the problem.
I saw in filechooser example the same way of inserting the buttons.
Maybe you can answer the following question. I created the code with Glade 
2. In the initialize rotine the code generated is
Gtk_New_From_Stock (Sphere_Level.Cancelbutton1, "gtk-cancel");
Set_Relief (Sphere_Level.Cancelbutton1, Relief_Normal);

Set_Flags (Sphere_Level.Cancelbutton1, Can_Default);
Pack_Start (Get_Action_Area (Sphere_Level), Sphere_Level.Cancelbutton1);
Gtk_New_From_Stock (Sphere_Level.Okbutton1, "gtk-ok");
Set_Relief (Sphere_Level.Okbutton1, Relief_Normal);

Set_Flags (Sphere_Level.Okbutton1, Can_Default);
Pack_Start (Get_Action_Area (Sphere_Level), Sphere_Level.Okbutton1);
Gtk_New_Hbox (Sphere_Level.Hbox1, False, 0);

I just used Stock items so I thought I could just assume that they should 
work without being created from the outside.
Maybe I am spoiled by using Microsoft Visual Studio.

L. Dries

"Dmitry A. Kazakov"  schreef in bericht 
news:wo75xb7mq2eq$.1ehqghgzzsg19.dlg@40tude.net...

On Sat, 9 Jul 2011 12:37:58 +0200, ldries46 wrote:

> I created a dialog with an OK and a cancel button.
> When I call the dialog using Run(dialog) only the quit button of the 
> window
> gives a response. The OK and the Cancel button do not even give any
> response. I found this by using the Debug facility of GPS.
>
> What do I do wrong.

1. You didn't post the complete code

2. You were running GTK under the debugger, which might lead to
unpredictable results.

> I expected the buttons to react with giving the
> gtk_response_OK or _Cancel value retuirned by Run

As a general note, when adding buttons to the dialog you have to use
Add_Button, which specifies the response for the button being added.

If you don't do that, simply placing a button into the dialog as a
container, you have to catch the signal emitted by the button and close the
dialog manually from the handler.

Either method works.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de 




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: response on OK button
  2011-07-12 10:10   ` ldries46
@ 2011-07-12 15:15     ` Dmitry A. Kazakov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry A. Kazakov @ 2011-07-12 15:15 UTC (permalink / raw)


On Tue, 12 Jul 2011 12:10:47 +0200, ldries46 wrote:

> I just used Stock items so I thought I could just assume that they should 
> work without being created from the outside.

A stock button is a button as any else, it do nothing but sends signals. It
is up to the container (e.g. the dialog) to do something with the signal.

> Maybe I am spoiled by using Microsoft Visual Studio.

Huh, I never use any generators be of MS VS (a horrific mess that corrupts
your resource and header files) or GLADE. With them you might quickly get
something working, but what you get will never work as you wanted it to do. 

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-12 15:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-09 10:37 response on OK button ldries46
2011-07-09 12:14 ` Dmitry A. Kazakov
2011-07-12 10:10   ` ldries46
2011-07-12 15:15     ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox