Thanks Andrew.
Unfortunately, I am still having a problem.
Hopefully a brief read of this Delphi excerpt by a set of fresh eyes will tell me what I am doing wrong.
I loop through a table and make a decision whether a field should be a radio button, (mutually exclusive) or simply a checkbox. The checkboxes work fine. Only the first radio button can actually have its value set. All subsequent attempts to set a value fail.
The raw code with the diagnostics included are shown. I test to see if the value can be set on the radiobutton field. It is successful if it happens to be the FIRST radiobutton in a group. After that it will not set the value.
Thanks for any insight anyone might have.
Sincerely,
John
if OptionsBookMasterQuery.FieldByName('MutuallyExclusive').value = True then begin r2 := DPL.NewFormField(OptionsBookMasterQuerySelectionName.value, 4); MarkNone := True; ///variable used to decide if a "None" radiobutton will be shown/value set Showmessage('Created: ' + inttostr(r2)); ///diagnostic confirms the index number is there end;
... while not Form1.OptionsBookQuery.eof do Begin ProspectusPriceListCheckQuery.close; ProspectusPriceListCheckQuery.Params[0].Value := Form1.CustomerLocalcustnmr.value; ProspectusPriceListCheckQuery.Params[1].Value := Form1.OptionsBookQueryRecord.value; ProspectusPriceListCheckQuery.Open;
if ((OptionsBookMasterQuery.FieldByName('MutuallyExclusive').value <> True) or (OptionsBookQuery.RecordCount = 1)) then begin /// checkboxes work fine...problem down below with radio buttons r0 := DPL.NewFormField(Trim(FloatToStr(OptionsBookQueryRecord.value)), 3); ///checkbox DPL.SetFormFieldBounds(r0, 50, Vertical - 15, 20, 20); DPL.SetFormFieldCheckStyle(r0, csCheck, 1); DPL.SetFormFieldBorderColor(r0,0,0,0);
end;// else
if OptionsBookMasterQuery.FieldByName('MutuallyExclusive').value = True then
begin Showmessage('Field: ' +OptionsBookQueryName.value + ' ' + Trim(FloatToStr(OptionsBookQueryRecord.value)) + ' '+ inttostr(r2));
r1 := DPL.AddFormFieldSub(r2, Trim(FloatToStr(OptionsBookQueryRecord.value))); Showmessage('SubField: ' +OptionsBookQueryName.value + ' ' + Trim(FloatToStr(OptionsBookQueryRecord.value)) + ' '+ inttostr(r1));
DPL.SetFormFieldBounds(r1, 50, Vertical - 15, 20, 20); DPL.SetFormFieldCheckStyle(r1, csCheck, 1); DPL.SetFormFieldBorderColor(r1,0,0,0); If ProspectusPriceListCheckQuery.recordcount = 1 then begin c1 := 0; c1 := DPL.SetFormFieldValue(r1,'Yes'); if c1 <> 0 then showmessage('SUCCESS'); c2 := 0; c2 := DPL.SetFormFieldValueByTitle(Trim(FloatToStr(ProspectusPriceListCheckQuery.fieldbyname('PriceListRecordNumber').value)),'Yes');// if c2 <> 0 then showmessage('SUCCESS 2'); Showmessage('R1 ' + DPL.GetFormFieldValue(R1)); MarkNone := False; end; end;
|