On Jun 30, 2006, at 2:34 PM, Chuck Pelto wrote:
Hi Fargo,
On Jun 30, 2006, at 12:55 PM, Fargo Holiday wrote:
I'm certainly no expert, but couldn't you just track the change
using a global variable, which is updated via the radiobutton's
index when Action is fired? Maybe even create a method to convert
the index result to whatever data you need, then update your global
(s), and have that method called when Action fires.
That's an interesting idea, but I'm afraid it doesn't really
address the issue I'm grappling with here.
I'm trying to come up with a mechanism, i.e., a method inside of a
module, that can easily identify the field inside of a V4RB2
database that is changed as the result of someone clicking on a
RadioButton inside ANY GroupBox collection of such controls.
The concept is that every RadioButton will have a boolean field in
the V4RB2 database associated with it.
If one RadioButton is selected, i.e., set to TRUE, I can easily
capture that using the Action to call the module-method. However,
since REALbasic (RB) automatically turns the other RadioButtons in
the GroupBox to FALSE, it's not as easy as I would like to capture
those reset controls in the V4RB2 database fields associated with
them, as there is no way to easily hook into the mechanism that the
GroupBox is using, at least as far as I can determine.
I've tried the approach that Terry Ford suggested; setting the
value of a RadioButton with a line of code. But he is correct that
setting a RadioButton's value to FALSE does NOT trigger an Action
event. As a result, both boolean fields in the V4RB2 database, each
associated with one of the buttons, are now showing TRUE; which
should not be the case.
So, I guess I'll just have to knuckle down and write the necessary,
but egregious, extra lines of a loop to do something that I am
confident, REALSoft can build into RB in the, hopefully, not too
distant future; a means to call Actions and/or a call to a GroupBox
that will return the caption of the selected RadioButton.
However, I'm open to other suggestions on how to skin this
particular cat.
The long answer is don't do it this way at all.
Create your own set of control subclasses that you use and that you
have a nice well defined interface to get/set values from a class.
That class may/may not have come from a database. If it has come from
a database then you would make this object able to save itself to a
db and recreate it from a database. This is a big portion of the
point of frameworks like Hibernate, EOF, & Cayenne.
V4RB has a very OO approach already, but I'm not aware of a way that
you can bind a UI object like a radio button to a V4RB class.
They may have a way to do this so that any time the UI object is
changed the underlying V4RB object is updated.
This is a lot like filemaker where every time you change something it
is immediately written to the DB. All changes are "live"
Some others on the list have dome something like this already with
various private frameworks they have for interacting with a database.
The up side to doing it this way is that the intermediate class can
act as a buffer for changes and you can then simply tell it to save,
cancel, or revert all changes.
It's an extra layer of abstraction that, in the long run can save
time and money
I'm pretty sure that's not what you wanted to hear but it's how I'd
do it as it's more powerful and reusable and quite possible to do
with just some RB
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>