PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Gary Stout on January 21, 2015, 09:22:30 PM

Title: 2 questions regarding my program conversion
Post by: Gary Stout on January 21, 2015, 09:22:30 PM
Hello all,

I am making good progress on my program conversion from EZGUI. The two issues I am up against right now are:

1)need to prevent a form from being dragged with the title bar

2)need to simulate clicking a button from code. The old way I did things used POSTEVENT. What I am trying to do, is when a tab is changed, I need to simulate in code a button being clicked to clear the fields on the tab the user is going to, just incase there is any stray data in the fields.
I have the Tab Change code working fine...just not sure how to simulate the Button click.

Thanks again,
Gary
Title: Re: 2 questions regarding my program conversion
Post by: David Kenny on January 21, 2015, 11:13:22 PM
1) Place the following line in the Form's create routine:DeleteMenu GetSystemMenu (hWndForm,0), %SC_MOVE , %MF_BYCOMMAND

2) Not sure exactly what you are asking. But every routine in your program can alter the contents of fields on any form.  Have you tried just setting the fields in the Tab Change routine?  All the "Handles and IDs", found in the dialog of the same name (F4) are defined as global.

David
Title: Re: 2 questions regarding my program conversion
Post by: Paul Squires on January 22, 2015, 12:42:16 AM
Quote from: Gary Stout on January 21, 2015, 09:22:30 PM
1)need to prevent a form from being dragged with the title bar

Seems to me that you asked this already... over 4 years ago :)
http://www.planetsquires.com/protect/forum/index.php?topic=2708.msg20365#msg20365

Title: Re: 2 questions regarding my program conversion
Post by: Paul Squires on January 22, 2015, 12:49:37 AM
For question #2: http://www.planetsquires.com/protect/forum/index.php?topic=3486.0
Title: Re: 2 questions regarding my program conversion
Post by: Gary Stout on January 22, 2015, 12:58:49 AM
Thanks David and Paul,

Embarrassed Paul! I am a creature of habit and tend to do that often  :o

On #2 David, when the the tab control change event has been fired, I need to simulate through code a button click. I may not have explained it well enough the first time.

Thanks again and sorry Paul about being repetitive  :)

Gary
Title: Re: 2 questions regarding my program conversion
Post by: David Kenny on January 22, 2015, 01:07:28 AM
Yea, I got the part about you needing to simulate a button push. :)  My question is why you need to simulate a button push?  What happens when that button gets pushed by the user?
Title: Re: 2 questions regarding my program conversion
Post by: Gary Stout on January 22, 2015, 01:15:01 AM
David,
Basically the button clears a bunch of fields, which if the user clicks the button, the fields will clear but what I am also wanting to happen is when the user clicks the tab, if there should be stray data that was entered but never saved, the fields would be automatically cleared when they go back to the entry tab. Clicking the clear button would also do the same thing, I just was trying to avoid duplicating the same code twice (in the button click and the tab change).

Gary
Title: Re: 2 questions regarding my program conversion
Post by: David Kenny on January 22, 2015, 01:24:28 AM
Quote from: Gary Stout on January 22, 2015, 01:15:01 AM
I just was trying to avoid duplicating the same code twice

That's what I thought.  It would be easier IMO, to put the button click routine in a sub and call it from the button click routine and the tab change routine. And your need for the simulated button push goes away to boot.
Title: Re: 2 questions regarding my program conversion
Post by: Gary Stout on January 22, 2015, 01:31:39 AM
Thanks David, that sounds reasonable and does seem like a cleaner way of doing things. Some times I tend to make things harder than they need to be. In my old program, I was using postevent to simulated the button press and was stuck in that rut and way of doing things.

Thanks again for all of your help!

Gary
Title: Re: 2 questions regarding my program conversion
Post by: José Roca on January 22, 2015, 06:11:42 PM
To simulate a button click all you need is:


SendMessage hButton, %BM_CLICK, 0, 0

Title: Re: 2 questions regarding my program conversion
Post by: Gary Stout on January 22, 2015, 06:23:19 PM
Thanks Jose!
That looks easy enough. I am still on the uphill side of the learning curve for FF, but learning a little each day and liking it more and more. I am just sorry now that I didn't give it more of a chance way back. I tried it and got discouraged and gave up. For some reason, it seems easier this time around.
I also want to thank you for all of the wrappers you have contributed to the FF community!

Gary