OnChange Event Question

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
Red2
Posts: 273
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

OnChange Event Question

Post by Red2 »

In the IDE when I select a form's TEXTBOX control, click its “Events” tab to add code to its OnChange event then an “OnChange” .PRG is added. However, this .PRG is specific to that control. If I attempt to add it to another TEXTBOX control I get error, “Module Already in Project. Aborted”.

The issue: I have a form with over 20 TEXTBOX controls. I want one single (generic) function called by the OnChange event in all of these TEXTBOX controls. That is, I want to avoid 20 duplicate “OnChange” .PRGs unnecessarily cluttering the project.

Question: Is there a simply way to generically handle all of these OnChange events using one single function?

I would appreciate your kind guidance on how this is best accomplished in HMG.

Thank you, Red2
User avatar
mol
Posts: 3721
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: OnChange Event Question

Post by mol »

You can assign this defined function to this event without creating new .prg. Don't use plus button, simply type your function name with parameters
Red2
Posts: 273
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: OnChange Event Question

Post by Red2 »

Hi mol,

Thank you very much. That was so obvious and simple but I missed it.

Thanks again!

Red2
Post Reply