Hello Katarina, On Jan 20 13:17 Katarina Machalkova wrote (shortened):
I like to permanently bind the Enter key to a PushButton.
Currently I have in source/printer/src/basicadd.ycp --------------------------------------------------------------- `HBox ( `PushButton ( `id(`apply_driver_filter), `opt(`default), _("&Search for") ), `InputField ( `id(`driver_filter_input), ---------------------------------------------------------------
Hmm, I did exactly the same in webpin client ... (http://bugzilla.novell.com/show_bug.cgi?id=538774)
Unfortunately `opt(`default) does not work here.
... and it worked reasonably well for me. Odd :(
I use exactly the same since a longer time in yast2-scanner in source/scanner/src/dialogs.ycp where it worked and works all the time as far as I remember for Qt and Gtk but it does not work for yast2-printer in source/printer/src/basicadd.ycp
Which UI are you trying, btw? It doesn't (never did and never will) work in ncurses. Then maybe you're hitting a Gtk bug I had reported and Ricardo fixed in the meantime (http://bugzilla.novell.com/show_bug.cgi?id=558900)
Ahh! It works for me in yast2-printer with Qt but not with Gtk so that it seems yast2-printer is hit by another instance of http://bugzilla.novell.com/show_bug.cgi?id=558900
I assume whatever Wizard::... function call afterwards invalids this `opt(`default) and re-sets the default back to 'Next' or 'Back'.
I assumed this was gonna happen too, but in the end it was not the case. Back then, to solve the problem I was thinking about adding a new function to Wizard, something like Wizard::SetNextButtonNonDefault( any id, string label ) - much alike to existing SetNextButton() call, just without `opt(`default)
For me Wizard::SetNextButtonNonDefault looks like a somehow indirect workaround for the initial issue which is to set a particular widget to be the one which the Enter key triggers so that its widget ID is the result of UI::UserInput. Therefore I would more prefer to have a direct function to bind the Enter key to a widget if this is possible. If such a function exists, it may also enable the widget if it is in state 'disabled'.
Which Wizard:: calls are used here? Maybe we'll need to extend the Wizard API and/or fine-tune Wizard widget (used by GUIs) now ...
If you still need the exact code, it is perhaps easiest to look directly at source/printer/src/basicadd.ycp in YaST SVN. Kind Regards Johannes Meixner -- SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany AG Nuernberg, HRB 16746, GF: Markus Rex -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org