March 29, 2024, 04:07:41 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Changing from radiobox to checkbox

Started by JoaoAfonso, October 13, 2007, 02:39:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JoaoAfonso

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
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

JoaoAfonso

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?
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

GWS

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
Tomorrow may be too late ..

JoaoAfonso

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.
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900