Subject Re: [IBO] Multi Select Problem
Author Helen Borrie
At 10:15 AM 25/11/2004 +1100, you wrote:

>I am hoping that someone in the group has come across the same problem I am
>facing, and may share her/his solution with me.
>I have an application which allows application users to insert, update,
>delete records from a DB. Since there are multiple tables in the DB, I
>decided to have a MDI application, where a parent form launches a child
>form, thus grouping tables into related areas.
>The Child form makes use of TabControls so that a form may contain numerous
>tabs, which share a IB_Query, IB_DataSource, IB_Grid, IB_NavigationBar,
>IB_UpdateBar, IB_LoohupCombo, IB_LookupList. So as you can imagine the code
>is as OO as possible.
>My problem is as follows.
>I now have the need to use bitmasking techniques for a particular field in
>some tables of the DB. The bitmasks may represent things such as the
>required level of detail to be logged (0 none, 1, exceptions, 2 general
>errors, 4 Logical flow, etc) so if the user wishes to view logs for
>exceptions and logical flow she/he can set the bitmask to 5, and the
>application which uses the data will read the bitmask data and display logs
>For the application user to set this bit mask, as well as the other required
>data on the same table, I would like some friendly way to do this, ie say
>checkboxes for each possibility (thus, if the bitmask is 4 bits wide there
>can potentially be 7 checkboxes). I would like this 7 checkboxes to be
>linked to the selected record, so that IBObjects would do the hard work in
>the background, as it is the case with IB_LookupCombo, IB_LookupList.
>We currently have a utility class that automatically creates checkboxes on a
>TScrollBox and sets the state of each checkbox based on the mask value it is
>provided. The utility class also provides the new mask value should the
>user change one or more of the states. Is there anyway we can utilise this
>class so when the record is updated it will grab the mask value from our
>object (like IB_LookupCombo, IB_LookupList). If not, is there someway to
>link checkboxes to a grid so that it behaves in the same way as the
>IB_LookupCombo, IB_LookupList ( master detail scenario)? Or another

Geoff might have something in Enhanced Components that will do this...

Otherwise, I'd just store (and maintain) a stringlist that is read and
updated by your scrollbox control. Load it from the same dataset that is
populating the data-aware controls. Match the indexes of the stringlist to
those of your droplist and keep them in synch via method. Hold a
parameterised ib_dsql to fire off update or insert statements as required,
and refresh the lookup set afterwards. Put all of this into a procedure
that runs at FormCreate and whenever you need to call it during the user

From your description, I can't clearly see what would be embedded in a
grid, since your array of bits isn't data-aware...if the users are setting
the bits via checkboxes and the application is parsing them both ways, why
would the users need to see the stored structure?