Normal Topic User Defined Hot Keys (Read 2147 times)
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
User Defined Hot Keys
Oct 7th, 2004 at 10:16pm
Print Post Print Post  
Watching the discussion on selecting Tree Branches made me wonder about a future option.  I am so used to having hot keys for many functions, and it would be nice to create our own hot keys.   Want to eliminate jumping to the mouse from the keyboard, and reduce long programming commands where possible.

Any possiblility of having a function, something along the lines of this?
Quote:
@HotKey(ID, DefineKeyCombo, Command/Function/Macro to be executed)  (@HK is shorthand)
There would certainly be a list of reserved key combinations, but we could even override Windows keys within Sesame if we wanted to?

Examples :
Quote:
@HK(4, ALT-CTL-S, @SelectTreeItem("Search Update Menu!Navigation!Save Record")  )

or

@KotKey(2, SH-ALT-P, @SelectTreeItem("Search Update Menu!Record Commands!Printing Commands!Print Form to Default")  )
1.  ALT-CTL-S would run @SelectTreeItem("Search Update Menu!Navigation!Save Record"), and HoyKey(4) could be used in a programming statement to call the HK combo.
2.  SHIFT-CLT-P would run @SelectTreeItem("Search Update Menu!Record Commands!Printing Commands!Print Form to Default"), and HoyKey(2) could be used in a programming statement to call the HK combo.
==============
Getting greedy now..... would also need the ability to review/print out the assigned hot keys.  These reassignments would be killed automatically if going outside Sesame applications. or when Sesame is closed.

I do have this ability in other Windows programs, so I would think that this should be technically possible within Sesame.

If not a function, then how about a built in  Applications options for Point/Click to make definitions.   Could see existing settings, and see which are still available when assigning values.

If needed, I can direct you to a sample of how this is done elsewhere.

No, I don't expect to see this in 1.0.5, I could survive by waiting until 1.0.6  Grin
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: User Defined Hot Keys
Reply #1 - Oct 10th, 2004 at 2:03pm
Print Post Print Post  
User defined keystrokes can be a problem in two regards:

1. In GUI programs events are not handled by a central module, they are instead, passed to windows, each of which responds to, or chooses not to respond to an individual event. That means that any particular keystroke can have, or fail to have, meaning to any particular window. So the SBasic programmer, setting up these keystrokes would have to be extremely context aware, and the duration of that keystroke's "meaningfulness" would have to be limited to the duration of the context that set it. In other words - what does your keystroke do if there is no record to save, or if there are nine records to save (open in nine forms, but the user is on the application menu)? Everyting in a GUI program, is about context. Context is both a set of modes (unfortunately) and temporal. This is why, in all programs, macros need to have known starting points. This is why, in Q&A, keystrokes that are not appropriate to the current menu or dialog, do nothing. Should we allow the programmer to alter an existing keystroke, we would also have to tell each of the contextual components that react to that keystroke, not to react - thus causing them to no longer function, unless the programmer also supplies a replacement keystroke in each and every context.

2. Having a different set of commands/keystrokes for each and every application that is deployed means that no one can ever gain runtime expertise in the package. The learning curve for commands must be relearned with every installation of each and every application. Even on the same desktop, two different applications of Sesame may (and likely) will behave and react entirely differently, based on which programmer created it. Additionally, it becomes impossible for a third party (like Lantica) to support the application, in that the users can only learn the package based on the narrowed set of commands as defined by their programmer, who may well have moved to Japan in the interval.

On the other hand:
I would like to add to Sesame, the ability for the programmer to launch code based on hotkeys or menu events. It would have to be limited to keystrokes not already assigned in that context, and the code would have to be context sensitive. There have long been plans to add user defined pulldown menus to the menubar. These items would be set to run either a macro or a chunk of SBasic. The problem is still context. The programmer would have to have some way to tell Sesame which form under which mode, each menu or menitem appears or is active. Unassigned hotkeys could then be assigned to the menu and its items and only become "hot" when the system is in the appropriate mode and context.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
bstone30
Member
*
Offline


No personal text

Posts: 28
Location: USA
Joined: Dec 16th, 2003
Re: User Defined Hot Keys
Reply #2 - Oct 12th, 2004 at 1:32pm
Print Post Print Post  
Ok, I think I understand why the macros we loved in QA won't work in Sesame.  So, what would be the best way to replace a list of about 30 macros that are critical to entering data on a form?  This is a translated QA database and the data in the original field must be retained.  The database handles court records and the field where the macros are used is called "Charge".  The macro is entered to facilitate the entry of the actual charge for the ticket, such as "Passing In A No Passing Zone".  The next field looks up the charge and retrieves the Fine and Bond amounts for the particular offense.  Before I begin tackling this problem, I would like some advice on the best way to proceed.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: User Defined Hot Keys
Reply #3 - Oct 12th, 2004 at 1:56pm
Print Post Print Post  
Normally in both Q&A and in Sesame, you would do what you describe using an XLookup program, not a macro.

In most cases, you can replace what you used to do with macros by using SBasic.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: User Defined Hot Keys
Reply #4 - Oct 12th, 2004 at 2:06pm
Print Post Print Post  
Quote:
Ok, I think I understand why the macros we loved in QA won't work in Sesame.  So, what would be the best way to replace a list of about 30 macros that are critical to entering data on a form?  This is a translated QA database and the data in the original field must be retained.  The database handles court records and the field where the macros are used is called "Charge".  The macro is entered to facilitate the entry of the actual charge for the ticket, such as "Passing In A No Passing Zone".  The next field looks up the charge and retrieves the Fine and Bond amounts for the particular offense.  Before I begin tackling this problem, I would like some advice on the best way to proceed.   


1. You could re-record the macros for Sesame. If they are all as simple as changing the content of a LE, this may be the simplest way to go. Not very maintainable. Macros in a GUI tend to be very complex and opaque - nearly impossible to edit effectively. If you need to do more than simply fill out a LE, Sesame does allow macros to be nested. That means you can build a complex macro from a bunch of simple ones. That, in turn allows you to re-record a very small and simple macro, thereby editing the complex macro in parts.

2. You can (and probably should) use SBasic to perform the same functions as the macros. That will allow you error control, some context control, conditional behavior, and more editability.

3. Mix SBasic and Macros using the @Macro function. There are a few actions that macros can do that SBasic cannot. Build macros that do one simple task and chain them together with @Macro calls in SBasic to perform a complicated series of actions. This gives you the best of both worlds.

Advice: If you are going to use macros, be aware that they will expect Sesame to be in the same state at runtime as it was when the macro was recorded. Also remember that warning and error dialogs that will interfere with the macro are disabled during recording and playback.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
bstone30
Member
*
Offline


No personal text

Posts: 28
Location: USA
Joined: Dec 16th, 2003
Re: User Defined Hot Keys
Reply #5 - Oct 12th, 2004 at 2:15pm
Print Post Print Post  
I'm not sure you understand the situation.  The way the QA database works is you type a macro keystroke such as "Alt-a" and the macro types the predefined text in the field. The next field looks up the text entered by the macro and retrieves information for two subsequent fields.  This has saved countless keystrokes over the years in QA.  The data entry clerk is so used to the macros that eliminating them would be hard to adjust to.  You mean, I've been doing this the wrong way for 15 years?  The macros worked really well for 15 years, even if they were the wrong way of doing it.
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: User Defined Hot Keys
Reply #6 - Oct 12th, 2004 at 2:48pm
Print Post Print Post  
Quote:
The way the QA database works is you type a macro keystroke such as "Alt-a" and the macro types the predefined text in the field. The next field looks up the text entered by the macro and retrieves information for two subsequent fields.


The following is a generic code to match your description: 
Quote:
Field1 = "Full Name"

Field2 = @XLU( @FN, Field1, "formName!Customer", "Account")

Field3 = @XLU( @FN, Field2, "formName!Account", "Phone")
Field4 = @XLU( @FN, Field2, "formName!Account", "Email")
  "Full Name" is entered into the first field.  The second field looks up the Account ID for the value "FullName" entered into the first field.  Then the Phone and Email values are entered into fields 3 and 4 based on the Account ID value in field 2.

=============================
The code could be called by clicking on a button, or based on the value of a drop down list, based on an event on any field on your form, depending on where you locate this code in your form.  But you will not be able to have a hot key like ALT-A like you did in Q&A. 

Whatever you did in Q&A was not wrong if it worked.  There are many ways to accomplish the same results.  A phrase that is used in my hobby as a magician is "using your favorite method.......".  (Translated in magic circles means the details were not provided because the author does not know how to do it either, ie, "Using your favorite method, move the ten of hearts to the sixteenth position.").

The same thing applies to Q&A, Sesame, and any other programming environments.  Use the method that you are comfortable with that produces the correct results.  Someone else will always be able to come with an alternative method, maybe faster, maybe less memory required, maybe fewer lines of code, but in the long run it probably does not matter.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: User Defined Hot Keys
Reply #7 - Oct 12th, 2004 at 2:59pm
Print Post Print Post  
Quote:
...  You mean, I've been doing this the wrong way for 15 years?  The macros worked really well for 15 years, even if they were the wrong way of doing it.


I didn't mean to imply that you (or Q&A) were doing anything "the wrong way". I was trying to post a set of approaches you could use to implement automation (in general).

Given, how you are using macros, I would be tempted to replace them with a combo-box. That way the user can select an item off of a list, and they do not have to memorize which keystokes go with which values. And, after they have learned what values are available, simply typing the first letter of the option will automatically select it. Addtionally, using PopulateListElement, a set of combo-box values can can set dynamically. If the LE is only allowed to have a particular set of values, a List Box LE disallows any typing - and thereby disallows any "creative" responses.

Of course, in terms of time savings, if the element must be a text box (though I don't know why that would be), Ctrl-Enter will provide a list of the last 10 values typed into that text box.

If none of these approaches are flexible enough: the On Immediate Change event will allow you to enter a keystroke into the LE, catch that keystroke and replace it with any of a set of pre-defined values that "match" that keystroke.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
bstone30
Member
*
Offline


No personal text

Posts: 28
Location: USA
Joined: Dec 16th, 2003
Re: User Defined Hot Keys
Reply #8 - Oct 12th, 2004 at 4:40pm
Print Post Print Post  
Ok, "slapping myself in the head".. the Sbasic programing worked great and actually is easier than using macros.  It seems faster than using macro keystrokes and will certainly be easier to modify.  This was my first experience with converting a database with macros.   Thanks for your help.
  
Back to top
 
IP Logged