Advise on Forms

Post your Gambas programming questions here.
Post Reply
AndyGable
Posts: 362
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Advise on Forms

Post by AndyGable »

Hi Everyone

I was hoping someone could advise me on something

I have a EPoS application that was designed for a Keyboard I am now turning it into a touchscreen application

Image

The idea is when the user touches the "Sign on off" button key the form "frmsignedoff" would think the key A has been pressed (as this is the key on the keyboard for that function)

Image

Yes I know I could change the code so the button would display the sign on key but the F1-F8 (top buttons) all have tons of code written for them already

I would like it so the forms still function the same (as the system has so much code already for the given support i could not really re do them to run on the keys

Image

I don't mind updating the code that handles the "key" presses but I don't really want to start from scratch again.

I am using the workspace1 to hold my user forms (eg the salescreen form and the Tender screen etc)

would there be a way to get the active form (example say the sign on screen is showing (in the second Pic) (its name is frmsignon) and have a public function called for example TouchKey(FucntionName as string) and have something like

Public Sub TouchKey (FunctionName as string)
      Select case FunctionName
         Case "Key_1"
           do the code for the Singon
      end select
end 
User avatar
BruceSteers
Posts: 1559
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Advise on Forms

Post by BruceSteers »

I'm not sure I understand what you need.

There's Application.ActiveWindow
https://gambaswiki.org/wiki/comp/gb.qt4 ... tivewindow
If at first you don't succeed , try doing something differently.
BruceS
AndyGable
Posts: 362
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Advise on Forms

Post by AndyGable »

ok so I have lets say I have a form that take a input of 0-9 (the number keys)

the number keys are btn_Key0 - btn_Key9 and they live on the form frmbackground

in the workspace1 I have a form called frmqtyRequest

how can I send the numbers to the currently active form in the workspace1?

so when I click say the button 3 the number 3 would show in the input box of the form
User avatar
BruceSteers
Posts: 1559
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Advise on Forms

Post by BruceSteers »

Can you just run the Form_KeyPress() method of the other form?
If you are in the KeyPress event of any form then Key object will still be valid in another so something like...

WorkSpace1.frmqtyRequest.Form_KeyPress()
If at first you don't succeed , try doing something differently.
BruceS
AndyGable
Posts: 362
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Advise on Forms

Post by AndyGable »

But how would I do that for the other forms

I have a few forms that take input for example

Frmsalescreen
Frmsignon
Frmtenderscreen


They all take number input

Would it be bette to move functions into a global function that uses a case select?
Post Reply