2013-08-18 4 views
5

IDをハードコードしないで、GtkDialogに事前定義された応答(例:GTK_RESPONSE_OK)を使用する方法はありますか? GladeはデフォルトでXMLを "0"で生成し、数字で入力します。私は-5を入力することができると思うが、それは定数を持つ点を打ち負かしているようだ。GtkBuilder XMLのGtkDialogで定義済みの応答IDを使用していますか?

ザ・グレイドのXMLは次のようになります。でもthe example in the docs

<action-widgets> 
    <action-widget response="0">cancel-button</action-widget> 
    <action-widget response="0">connect-button</action-widget> 
</action-widgets> 

のために)彼らは-5( GTK_RESPONSE_OKを使用していることを考えると、少し陽気です
<action-widgets> 
    <action-widget response="3">button_ok</action-widget> 
    <action-widget response="-5">button_cancel</action-widget> 
</action-widgets> 

( "button_cancel" ...)

+0

を行うことができますがあれば、私は知りませんが、そうでない場合、これは機能要求材料のように見えます。 – OdraEncoded

+0

も参照してくださいhttp://stackoverflow.com/questions/2725810/glade-3-standard-button-layout – GutenYe

答えて

1

GTK 3.12以降では、応答にnck-namesを使用できます。

commit baa471ec130c360a5c4ae314769bc7b858814219 
Author: Jasper St. Pierre <[email protected]> 
Date: Mon Oct 28 11:19:43 2013 -0400 

    gtkdialog: Allow specifying response IDs by nick in <action-widgets> 

    This makes it a lot more convenient for developers, as they don't 
    have to look up the numeric value of response IDs. 

ので、あなたが今

<action-widgets> 
    <action-widget response="ok">button_ok</action-widget> 
    <action-widget response="cancel">button_cancel</action-widget> 
</action-widgets> 
+0

https://developer.gnome.org/gtk3/stable/GtkDialog.html – AAAfarmclub

関連する問題