Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 20 Oct 2014, 18:55
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Xdialog combobox: How to edit text in entry field?
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [25 Posts]   Goto page: Previous 1, 2
Author Message
MochiMoppel


Joined: 26 Jan 2011
Posts: 424
Location: Japan

PostPosted: Thu 26 Dec 2013, 09:08    Post subject:  

I get the feeling that this thread gets more and more derailed into a discussion about gtkdialog issues... Crying or Very sad

rcrsn51 wrote:
Other than the issue with combobox, I have no problems with Xdialog.

I also have no serious problems. Xdialog is amazingly stable for such an old tool that was never meant to be used with gtk2.

I've tested now all widgets. Apart from combobox I found only 2 with problems:
yesno: --default-no option works only in combination with --check option; L18L reported a YesNo Bug, which I can't confirm for Slacko.
treeview: Doesn't work at all. Error message: Gtk-CRITICAL (recursed) **: IA__gtk_tree_store_append: assertion `VALID_ITER (parent, tree_store)' failed

Anything else?
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2225
Location: The Blue Marble

PostPosted: Thu 26 Dec 2013, 11:59    Post subject:  

Code:
jamesbond 2013
fix editable combobox problem under gtk2

Index: src/interface.c
==================================================================
--- src/interface.c
+++ src/interface.c
@@ -1220,25 +1220,45 @@
    open_window();
 
    set_backtitle(TRUE);
    set_label(optarg, TRUE);
 
-   combo = gtk_combo_new();
+#ifdef USE_GTK2
+   combo = gtk_combo_box_entry_new_text();
+   Xdialog.widget1 = GTK_ENTRY (GTK_BIN (combo)->child);
+#else
+   combo = gtk_combo_new();
    Xdialog.widget1 = GTK_COMBO(combo)->entry;
+#endif
    Xdialog.widget2 = Xdialog.widget3 = NULL;
    gtk_box_pack_start(Xdialog.vbox, combo, TRUE, TRUE, 0);
    gtk_widget_grab_focus(Xdialog.widget1);
    gtk_widget_show(combo);
+#ifndef USE_GTK2
    gtk_signal_connect(GTK_OBJECT(Xdialog.widget1), "key_press_event",
             GTK_SIGNAL_FUNC(input_keypress), NULL);
+#endif
 
    /* Set the popdown strings */
+#ifdef USE_GTK2   
+   for (i = 0; i < list_size; i++)
+      gtk_combo_box_append_text(GTK_COMBO_BOX(combo), options[i]);
+#else
    for (i = 0; i < list_size; i++)
       glist = g_list_append(glist, options[i]);
    gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
+#endif
+
    if (strlen(Xdialog.default_item) != 0)
+#ifdef USE_GTK2
+   {
+      gtk_combo_box_prepend_text(GTK_COMBO_BOX(combo), Xdialog.default_item);
+      gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
+   }
+#else
       gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), Xdialog.default_item);
+#endif
 
    gtk_entry_set_editable(GTK_ENTRY(Xdialog.widget1), Xdialog.editable);
 
    if (Xdialog.buttons) {
       button_ok = set_all_buttons(FALSE, TRUE);

This is confirmed to work.

Anyway, I started a repo for Xdialog here: http://chiselapp.com/user/jamesbond/repository/xdialog/index. I have applied most of amigo's patches and some of mine (including this one).

I don't have any problems on default-no and treeview.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2257

PostPosted: Thu 26 Dec 2013, 13:31    Post subject:  

Oh, thank you for that. I had already found that it was gonna need gtk_combo_box_entry_new_text() and gtk_combo_box_append_text but dreaded trying to get that going. You've answered our wish her.

Thanks very much for reporting back -I especially appreciate any fixes which apply to stuff I maintain on amigolinux.org. You mention other patches -do you have anything there I am not using?

I'll attach an archive of the patches I use(not including the one you just posted).
xdialog-gtk2-patches.tar.bz2
Description 
bz2

 Download 
Filename  xdialog-gtk2-patches.tar.bz2 
Filesize  13.53 KB 
Downloaded  95 Time(s) 
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2225
Location: The Blue Marble

PostPosted: Fri 27 Dec 2013, 01:29    Post subject:  

No worries, it's just giving back to the community.
amigo wrote:
Thanks very much for reporting back -I especially appreciate any fixes which apply to stuff I maintain on amigolinux.org. You mention other patches -do you have anything there I am not using?
I used:
1. 00-Xdialog-extra-button (from your patchset)
2. 01-Xdialog-gkt2-fixes-dougal (from your patchset)
3. 02-Xdialog-combobox-default-item (from your patchset)
4. default-no patch (based on yours, but "fixed" so that it works with NLS)
5. The editable-combobox patch above.
Oh and I use all the new icons from your patches too.

You can see the details and the patches if you visit that fossil page and go to timeline section.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2257

PostPosted: Fri 27 Dec 2013, 02:52    Post subject:  

I don't see how to view individual commits there, can you post a copy of your fixed default-no patch?
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2225
Location: The Blue Marble

PostPosted: Fri 27 Dec 2013, 03:23    Post subject:  

You can, but you need to login (anonymous login will do). But here is the patch for your convenience.

Code:
--- Xdialog-2.3.1/src/interface.c.old   2013-11-28 01:13:52.672894568 +0700
+++ Xdialog-2.3.1/src/interface.c   2013-11-28 01:25:58.662842053 +0700
@@ -489,8 +489,10 @@
          break;
 
    }
-   if (grab_default)
+   if (grab_default) {
+      gtk_widget_set_can_default(button, TRUE);
       gtk_widget_grab_default(button);
+   }
 
    gtk_widget_show(button);
 
@@ -742,6 +744,7 @@
 void create_msgbox(gchar *optarg, gboolean yesno)
 {
    GtkWidget *hbuttonbox;
+   GtkWidget *button;
 
    open_window();
 
@@ -759,7 +762,9 @@
          set_button(NEXT, hbuttonbox, 0, TRUE);
       } else {
          set_button(YES, hbuttonbox, 0, !Xdialog.default_no);
-         set_button(NO , hbuttonbox, 1, Xdialog.default_no);
+         button = set_button(NO , hbuttonbox, 1, Xdialog.default_no);
+         if (Xdialog.default_no)
+            gtk_widget_grab_focus(button);
       }
    } else
       set_button(OK, hbuttonbox, 0, TRUE);


_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7831
Location: qld

PostPosted: Tue 31 Dec 2013, 02:40    Post subject:  

Thank you Mr jamesbond

Sources uploaded to ibiblio http://distro.ibiblio.org/puppylinux/sources/x/Xdialog-patched_JB_131231.tar.gz for use in puppies from now on.

The date only reflects today, I downloaded it a few days ago, Xdialog-ec30703399f1ea0f is the commit.

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 424
Location: Japan

PostPosted: Tue 31 Dec 2013, 03:57    Post subject:  

01micko, I'm a bit lost here. Does this still relate to my initial question, and if yes, how can I benefit from the patch?
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7831
Location: qld

PostPosted: Tue 31 Dec 2013, 04:44    Post subject:  

http://distro.ibiblio.org/puppylinux/pet_packages-slacko14/Xdialog-2.3.1-i486-sJB.pet

MochiMoppel, try the linked pet and see if it solves your original issue.

Compiled in slacko. Smile

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 424
Location: Japan

PostPosted: Tue 31 Dec 2013, 06:19    Post subject:  

01micko, much obliged Very Happy
Regarding my original issue: solved...but. New issue: combobox entry field stays empty, while in old version first item was displayed by default.

Redarding the yesno issue: --default-no had no effect (Yes was still default button). Only when I added a checkbox with --check option the No button would fire upon pressing Enter. In this case the checkbox had focus and could be checked/unchecked by pressing the space bar. This is the normal behavior when using yesno box without --default-no option and is also normal behavior in other widgets, e.g. msgbox.

In the new patched version using --default-no together with --check sets focus to the No button instead on the checkbox. Not a big deal, but inconsistent.

All in all nice work. Thanks to all who contributed.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [25 Posts]   Goto page: Previous 1, 2
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0773s ][ Queries: 12 (0.0061s) ][ GZIP on ]