New topic: Dynamic Button labels
<http://forums.realsoftware.com/viewtopic.php?t=47795> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message WonkeyDonkey999 Post subject: Dynamic Button labelsPosted: Sun May 05, 2013 7:37 am Joined: Thu May 10, 2007 3:23 pm Posts: 8 Since I'm not an expert in these matters, I thought I would ask opinion here in the forums. I have a simple screen that includes amongst others a single button to click, allowing the user to select a file to be opened (I use a simple file selector dialog that allows the user to select a database file). Obviously they could select a valid database file (SQLite3) or any other type of file that is not a database. The pseudo code is like so : If the button label is 'Open' then show a file select dialog to pick a database file ..If a valid file then change the button label to 'Close" ..If not a valid file then change the button label to 'Clear If the button label is 'Close' then close the existing database file ..Change the button label to 'Open' If the button label is 'Clear' then empty the existing database file name property to "" ..Change the button label to 'Open' So I'm doing 2 things here. The first is writing conditional code based upon the button label as well as a couple of global properties. The second is changing the label of the button dynamically, depending what conditions have been met, as opposed to having 3 separate buttons. I wondered what opinion may be on this method of coding, is it considered ok to take this approach or should I revert back to separate buttons and base the conditional code around the global properties only ? Top DaveS Post subject: Re: Dynamic Button labelsPosted: Sun May 05, 2013 11:19 am Joined: Sun Aug 05, 2007 10:46 am Posts: 4845 Location: San Diego, CA Change the label on the buttons I would consider "acceptable" practice. Basing the conditional code execution based on the current label of the button, I would not _________________ Dave Sisemore iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top WonkeyDonkey999 Post subject: Re: Dynamic Button labelsPosted: Sun May 05, 2013 7:10 pm Joined: Thu May 10, 2007 3:23 pm Posts: 8 Thanks DaveS. I had a feeling that might be the case. Need to revisit the code I think. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
