button click event dose not work..why?

Started by khann, May 14, 2009, 07:32:20 AM

Previous topic - Next topic

khann

Hi. I've studied the ODCL Tutorial.
At first I made two good working buttons of Ok and Cancel.
In the first form, they work fine.

So now I making a new form and copied the two buttons from the first one in the same ODCL file.
I copied the buttons click event code too.
I also checked new button's click event.

But the new two button's click event dose not fire.
I've touched every stone in the new ODCL form and copied LSP codes.
It all seems fine.

What's the matter with the new two child buttons?

Please give me a light.
Thanks.

owenwengerd

The event handler function names must be changed for the copied buttons. Copy the event handler function name for the copied buttons directly from the events tab pane in OpenDDCL Studio to make sure it is correct.
Owen Wengerd (Outside The Box) / ManuSoft

khann

Thanks for your reply.
Yes, as you said. I've checked all the names and codes.
Well, does it matter? If one ODCL file have multi forms, and each form has the same OK button of same name, but the form names are different.
So the each OK button has different Event Handler code.
But in my case, only one form's OK button works in the first one.

One ODCL file has one form and one LSP code, is this a rule?

khann

It's the matter of Button's Drag/Drop Allow Begin property.
It should be False.

Thanks anyway.

owenwengerd

Quote from: khann on May 14, 2009, 05:21:37 PM
One ODCL file has one form and one LSP code, is this a rule?

It's generally a good idea, but it's not required.  You can use the same event handler for multiple controls; you just need to make sure the event handler names are correct in OpenDCL Studio.
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

QuoteYou can use the same event handler for multiple controls

For me it is even essential. Two examples:

1. Textbox control with numeric values for contruction
I often give OnKillFocus and OnReturnPressed the same event handler, cause they're doing the same: reading out the textbox content, check if it is zero or below zero and replace the invalid value with the latest valid value or setting focus again (after a messagebox). The easiest way to do the same is to use the same event handler.

2. BackColor change on MouseOver
In an image based menu I activate OnMouseEntered for the case the mouse comes into the control and I activate OnMouseOff when leaving. For leaving the control I use the same event handler as for all images for the menu.

So it's very comfortable for me.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]