Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Nov 16, 2018 5:17 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: question about checkboxes
PostPosted: Tue Mar 12, 2013 7:38 am 
Offline

Joined: Fri Oct 13, 2006 3:18 pm
Posts: 327
Hi there.

I have a little question about what might be the best way to handle checkboxes.

I have a person that wants to allow users to, on a window, select 1 or more checkboxes for different events they want to participate in.

I have a mySQL database, and wonder what the best way to handle this would be. I am thinking of having variables that will be set to TRUE, and if that is the case, insert a record for each one of those. The people filling out these forms will have to look at a form to see what there posting is for each event.

Has anyone else done this? How did they handle it. (Just looking for what might be a better way to do this other than the multiple variable way.

Regards


Top
 Profile  
Reply with quote  
 Post subject: Re: question about checkboxes
PostPosted: Tue Mar 12, 2013 9:20 am 
Offline
User avatar

Joined: Mon Nov 29, 2010 7:01 pm
Posts: 446
azrael2000 wrote:
Hi there.

I have a little question about what might be the best way to handle checkboxes.

I have a person that wants to allow users to, on a window, select 1 or more checkboxes for different events they want to participate in.

I have a mySQL database, and wonder what the best way to handle this would be. I am thinking of having variables that will be set to TRUE, and if that is the case, insert a record for each one of those. The people filling out these forms will have to look at a form to see what there posting is for each event.

Has anyone else done this? How did they handle it. (Just looking for what might be a better way to do this other than the multiple variable way.

Regards



If I were doing it, I would:
subclass the checkbox, something like DBCheckbox
Add a field called "DBfield" and add it to the properties' pane
Add a Load and Save method

Have a Load script that cycles through the windows controls loading in the proper checkbox state for the corresponding "DBField"
Have a save script cycle through the window controls and get the save value of each then add the record to the database.


Top
 Profile  
Reply with quote  
 Post subject: Re: question about checkboxes
PostPosted: Tue Mar 12, 2013 11:11 am 
Offline

Joined: Fri Oct 13, 2006 3:18 pm
Posts: 327
Thanks for the response neonash777.

I am afraid, at this point, I am going to show my ignorance of some things.

What do you mean by "subclass" the checkbox?

Regards


Top
 Profile  
Reply with quote  
 Post subject: Re: question about checkboxes
PostPosted: Tue Mar 12, 2013 12:01 pm 
Offline
User avatar

Joined: Mon Nov 29, 2010 7:01 pm
Posts: 446
azrael2000 wrote:
Thanks for the response neonash777.

I am afraid, at this point, I am going to show my ignorance of some things.

What do you mean by "subclass" the checkbox?

Regards



On the project tab click Add Class, change the name to DBCheckbox, change the Super to Checkbox
Open it up
Add a property called DBfield as string
Go back to the project tab and right click on the DBCheckbox class,
Click Property List Behavior,
Scroll down to your DBfield variable and mark it checked
Now when you drag an instance of DBCheckbox onto a window you can fill the DBfield option straight from the properties pane.
You could also set the DBfield value in the open event as an alternative.

Add your Save and Load events to the DBCheckbox class.


Top
 Profile  
Reply with quote  
 Post subject: Re: question about checkboxes
PostPosted: Thu Mar 14, 2013 8:08 am 
Offline

Joined: Fri Oct 13, 2006 3:18 pm
Posts: 327
thanks for the explanation.

Believe it or not, I did that once before but didn't know what it was called in "technical" terms!

Once again, thank you.

Regards


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group