Subject Re: [IBO] searchpanel question
Author Helen Borrie
At 01:10 PM 6/10/2003 +0200, you wrote:
>agree, that BOOLEAN was a bad choise - changed to BOOL_TYPE:
>
>CREATE DOMAIN BOOL_TYPE AS
>SMALLINT
>DEFAULT 0
>CHECK (VALUE BETWEEN 0 AND 1)
>However, check button doesn't appear in IB_Grid
>(IndicateBoolean-true;fetDomainName is set;BOOL_TYPE=BOOLEAN=1,0)

Did you test that in edit mode? It should appear on the current row if
AutoEdit is true, otherwise it will appear when you call the relevant
method Edit/Insert/Delete. btw, the checkbox in the grid isn't actually an
embedded TIB_CheckBox, it's an internal mechanism.

TIB_Checkbox should play nice in Browse mode. Of course, in search mode,
you won't see the data.


>So, if I have TIB_RadioBox descendant, how to use it in searchpanel instead
>check boxes - make TIB_SearchPanel descendant or there is an option
>somewhere else? Simple funny example: there is a questionable choice for
>user to set a gender using check box ;)

1 = Male, 0 = Female?


Well, I think if you always use 1=true and 0=False you could easily use
TIB_RadioGroup as it already is.

Have the OnChange event just do this:

MyRadioGroup.ItemIndex := MyQuery.FieldByName('aField').AsInteger;

To make it more generic you could do

procedure UpdateRadioBool (AControl: TIB_RadioGroup; ADataset: TIB_Dataset;
AFieldName: String);
begin
with AControl, ADataset do
ItemIndex := FieldByName(AFieldName).AsInteger;
end;

I'm feeling really sick tonight so can't test it but you get the idea...

Helen