Xdialog combobox: How to edit text in entry field?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#21 Post by jamesbond »

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

Code: Select all

--- 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 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#22 Post by 01micko »

Thank you Mr jamesbond

Sources uploaded to ibiblio http://distro.ibiblio.org/puppylinux/so ... 231.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.
Puppy Linux Blog - contact me for access

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#23 Post by MochiMoppel »

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?

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#24 Post by 01micko »

http://distro.ibiblio.org/puppylinux/pe ... 86-sJB.pet

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

Compiled in slacko. :)
Puppy Linux Blog - contact me for access

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#25 Post by MochiMoppel »

01micko, much obliged :D
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.

Post Reply