IonicWind Software

Creative Basic => General Questions => Topic started by: JoaoAfonso on October 13, 2007, 02:39:27 PM

Title: Changing from radiobox to checkbox
Post by: JoaoAfonso on October 13, 2007, 02:39:27 PM
Ahoy!

I am doing a program where when creating a form, a person can click in multiple items (checkboxes). After accepting that form, if at a later stage the person opens it again, I want to have radioboxes where checkboxes are.
- I tried to create those boxes (radio or check) at @idinitdialog, but it gives me error.

What solution have I?
Thought about when editing that form, check if a checkbox is clicked, and if yes, disable all the rest... but seems a "non-professional" solution :) For sure there are a trick here to make this work faster.

Thanks in advance
Title: Re: Changing from radiobox to checkbox
Post by: LarryMc on October 13, 2007, 04:43:50 PM
The approach I would take:

Create ALL your dialog controls when you create your dialog.  Hide those you don't want initially and create a global flag to tell you if you're calling the dialog the 1st time or the 2nd time.

If it is the 2nd time then in initdialog hide the first controls and show the 2nd set.


Larry
Title: Re: Changing from radiobox to checkbox
Post by: JoaoAfonso on October 14, 2007, 04:59:10 AM
hmm... that would be a solution, but everything around that dialog calls for those controlid... and I would have to name them all, then. There's not a way to "transform" them?
Title: Re: Changing from radiobox to checkbox
Post by: GWS on October 14, 2007, 06:35:23 AM
As I understand it, if you create one type of Windows control, it is assigned resources appropriate to that type of control and starts issuing messages to do with that type of control.  So you can't just change it into something else.  You can only delete it and create another type of control - or as Larry says, you create both types and hide the ones you don't require, and then hide the first and show the second set.

As you noted, this is by each individual control ID - maybe a bit long-winded.

Another way for your application would be to create two dialogs - one with check boxes - the other with radio buttons.
Then hide the one dialog and show the other - which would appear to change all the controls in one go. That might be easier to control ..  :)

all the best,

Graham
Title: Re: Changing from radiobox to checkbox
Post by: JoaoAfonso on October 14, 2007, 07:33:47 AM
Ok, I did the following, that works as I want: all those controls are checkboxes. When a person will try to edit the form and clicks in the checkboxes, it will always setstate=0 to every checkbox except to the one clicked.