Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Paradox Libraries 1

Status
Not open for further replies.

LMHtoMRR

MIS
Oct 30, 2003
3
US
I am trying to use the library feature to apply soem keyborad shortcuts to action s on fields.

My keyboard shortcuts work when I open the form, then I can use them on certain fields. However, if I try to put this copde in a library I get strange errors about what I can or can't do.

Let's assume that I want to change the default shortcut of F9 for editing to F3 through a library regardless of the form I might use this in.

Any ideas?

Any place I can look?

Thanks
 
I don't know how you would do that using a library. Normally that is something you would do in the keyPhysical method of the form itself. Below is a standard way of disabling the F9 key. Add another if/then for the F3 key, then assign an edit statement after the disableDefault.

Code:
method keyPhysical(var eventInfo KeyEvent)

   if eventInfo.isPreFilter() then
       ;// This code executes for each object on the form
      if eventInfo.vCharCode() = VK_F9
   	 then disableDefault
      endif	
         else
	    ;// This code executes only for the form
		
    endIf

endMethod



Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Mac,

Thanks for the feedback.

I only used this as an example. Unfortunately, it was a bad one to use. I wanted to make it as simeple as possible.

What I am trying to do is create a variety of keyboard shortcuts on a wide variety of forms. I am going to leave this project to someone else and I want them to be able to go to one place to make a change as opposed to having to go into the keyphysical event of every form I have. WHich by the ways is working for me now.

My challenge is that I can't get the same code that is currenly used on each form to work in a library. I have also experimented with scripts. Neither are working for me. I get errors trying to access objects on the form, etc.

Any ideas? How about this as an example:
I want to press F12 at any point in the form to display a drop down list on the form. Assumming there is only one drop down per form.

Again, this is only an example but hopefully one to lead someone in the right direction of what I am hoping to do.
 
Let me see if I've got this right. You wish to pass every keystroke to a library and then do something during the library method based on that keystroke?

The only thing that might work would be to return a string containing the instuctions (or "None"), then use executeString to do it.

For example, here is a BS library function that I simulated as a method. You would want to use a case/switch statement to get all the possible key events you plan to do something with:

Code:
method LibFunc(var eventInfo KeyEvent) string

if eventInfo.vCharCode() = VK_F9
	then return "var myForm form endvar
   		    if not myForm.attach(\"Test\")
                    then errorShow() endif
                    myForm.textBox.value=\"F9\""
   	   else return "None"
endif
endMethod

And here is the form's keyPhysical event

Code:
method keyPhysical(var eventInfo KeyEvent)
var
  retCmd  string
endvar

	if eventInfo.isPreFilter() then
		;// This code executes for each object on the form
    disableDefault
    retcmd=LibFunc(eventInfo)
    if retCmd = "None" then doDefault
    	else  executeString(retCmd)
    endif

	else
		;// This code executes only for the form
		
	endIf

endMethod

The above assumes a form with the title of "Test" containing a text field called "textBox".

I just did something simple for my test, changing the contents of a textbox. It also needs some sprucing up, since you'll want to actually pass the title value of the calling form using self.title so the library can know which form to attach to.

Like I said, this is a very simple example and it was a quick I-wonder-if-I-can-do-that exercise for me, so use with caution. Lance may have some better ideas or flaws I've overlooked.



Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Thank you.

I will try this early next week and let you know how it worked. I appreciate the feedback.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top