• Welcome to PlanetSquires Forums.
 

2 questions regarding my program conversion

Started by Gary Stout, January 21, 2015, 08:52:30 PM

Previous topic - Next topic

Gary Stout

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

David Kenny

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

Paul Squires

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Gary Stout

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

David Kenny

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?

Gary Stout

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

David Kenny

#7
Quote from: Gary Stout on January 22, 2015, 12:45: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.

Gary Stout

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

José Roca

To simulate a button click all you need is:


SendMessage hButton, %BM_CLICK, 0, 0


Gary Stout

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