patch for login window

Hi,

this patch (for tkabber 0.9.7) gives the focus to the "Log in" button on start up instead of the Password field, if the password is already set (eg from the user's custom.tcl file).

This is for people who don't have tkabber log in automatically, but have the password remembered, so just pressing space/enter will activate the login.

--
John McPherson
http://www.wlug.org.nz

--- ifacetk/ilogin.tcl.orig     2004-08-24 12:13:37.000000000 +1200
+++ ifacetk/ilogin.tcl  2004-08-24 12:17:02.000000000 +1200
@@ -265,7 +265,13 @@
 
     ifacetk::update_login_entries $l
 
-    .login draw $l.password
+    if ([string length $loginconf(password)]) { # length > 0
+        # password is remembered... give focus to login button
+        .login draw
+    } else {
+        # password string is empty - give focus
+        .login draw $l.password
+    }
 }

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Underline buttons and menu items

The next step in that direction is to underline the first letter in the button text so you can push the button by simply pressing Alt+L, no matter where is your cursor in the window.

I would like to go further: put letter underline shortcuts on every menu item and every button in Tkabber. I don't know the correct name for this functionality. Only the three main items in the menu have letter underline right now.

For example, let's add underline to 'Log in' button in Login window, file 'ifacetk/ilogin.tcl', line 255:

-   .login add -text [::msgcat::mc "Log in"] -command {
+   .login add -text [::msgcat::mc "Log in"] -underline 0 -command {

How to underline a menu item, for example the 'Services'->'Join Group' item. File 'ifacetk/iface.tcl' line 235:

-		       -command {join_group_dialog}] \
+		       -command {join_group_dialog} -underline 0] \

I was not able to underline cascade menu items, like 'Services'->'Sound'.

With this method, there is no need for translators to update their translation files, since it will underline always the first letter. But it leads to problems sometimes, if more than one item starts with the same letter. Changing the letter number in the Underline command is not a solution, since other languages may have problems like this constantly. So this solution is not the prefered one, since it's not i18n-compatible.

Another underlining method is to place a '&' symbol on the text before the letter you want to be underlined. Good news is that it can be used by translators. But it cannot be used on buttons, no idea why. The biggest problem is that, if Tkabber source code gets plenty of '&' in the messages, almost all the the translation files will need to be revised. So, before doing the update on source code, a script to update the translation files must be prepared.

And finally, some widely used menu entries should have an accelerator, like Discovery, file 'ifacetk/iface.tcl' line 232:

-		  [list command [::msgcat::mc "Discovery"] {} {} {} \
+		  [list command [::msgcat::mc "Discovery"] {} {} {Ctrl d} \

If nobody else makes those changes, I'll do them myself the following months.

You don't have to move focus

You don't have to move focus to login button. It is a default button, so pressing Enter will invoke it regardless of focus position (except cancel button).

login button focus

Ah. I had just upgraded from 0.9.4, which (from memory) behaved differently. Still, it means you can press spacebar to activate the login button instead of adding a space to your (already set) password.

I think that moving focus to

I think that moving focus to different fields is a bad idea. User have to think what to do when he see login window. For now he enters password (or doesn't enter if it's entered) and presses Enter key. It's simple. Why should one make things more complicated?

Maybe Resource field?

Well, if username and password are filled already, which field the user most likely will want to change? Of the login window fields it is Resource, isn't it?

Re: Maybe Resource field?

Yes, it's a good point. But certainly not Login button.

Syndicate content