PDA

Click to See Complete Forum and Search --> : UserControl Problems


Col
Feb 1st, 2001, 04:10 AM
I have written a Time Picker Control - In the same vein as the Date Picker but instead of a calendar, it drops down an analogue clock on which the user can set the time by clicking the hands.

All was fine until I tried using the control on a Modal form. Because the control uses a non-modal form to display the clock, I get an error because you can't open a non-modal form from a modal one. If I change the clock form to be non-modal, I do not get the error but I now can't click the DropDown button to close the clock. The date picker gets around this, so I would appreciate it anyone out there has any suggestions.

Thanks

Col.

robt
Feb 1st, 2001, 06:29 AM
Why don't you make the "clock" form a modal form ?

Col
Feb 1st, 2001, 10:37 AM
If I make the clock form modal, I do not get the error.

However, because this form is now modal, the user cannot click the drop down button on the control (because the button is not on the clock form) and so cannot close the clock form.

For now I have put an OK button on the drop down clock form which the user must click to close it.

I would like the control to behave in the same way as a combo box or date picker where by clicking off the dropped down portion will close it. Also, the user could reclick the dropdown button on the control to confirm their selection. This is how it works if the clock form is non-modal but I can't replicate this behaviour on the modal form.

robt
Feb 1st, 2001, 11:49 AM
Why are you using an additional form anyway ?

Why don't you just resize your control when the user clicks the "drop down" button. When the control is resized, you could then display your clock in it.

I'm assuming that you've got a text box control with a small button next to it so that it looks similar to a combo box ?

I would have thought that would be better.

Col
Feb 2nd, 2001, 04:17 AM
Yes - the control does consist of a textbox with a dropdown button.

I originally had the control resizing to display the clock as an additional part of the control but this caused problems if the control is sitting within a container (e.g. a frame). In this instance, when the user drops down the clock, the clock would disappear beneath the bottom of the frame and so would not be visible to the user. The only way to make it appear on top of the frame was to use a separate form for the clock.