Topic: ParentComboBox

Hi can we set  ParentComboBox by script , and not using the tool bar?

Re: ParentComboBox

The question is not clear. Expand the topic wider))

Визуальное программирование: блог и телеграм-канал.

3 (edited by v_pozidis 2023-10-18 14:28:10)

Re: ParentComboBox

See please the picture. Is there a way to do that by script ?

Post's attachments

Attachment icon parent.JPG 15.37 kb, 16 downloads since 2023-10-18 

Re: ParentComboBox

I cannot find or test the Property for the ParentCombobox.

dbFilter is a better workaround for me. It's powerful and can be used in so many way.

Post's attachments

Attachment icon TestParentCombobox.zip 548.4 kb, 57 downloads since 2023-10-18 

brian

Re: ParentComboBox

procedure Form1_cbA_OnChange (Sender: TObject);
begin
  if (Form1.cbA.ItemIndex = -1) then  Form1.cbB.Enabled := False
  else
  begin
    Form1.cbB.Enabled := True;
    Form1.cbB.dbFilter := 'id_a='+Form1.cbA.sqlValue;
    Form1.cbB.dbUpdate;
  end;
end;
Post's attachments

Attachment icon test.rar 4.12 kb, 52 downloads since 2023-10-18 

Re: ParentComboBox

Thank you... I need it because I like to have two choices for a search button.  A free choice (without parent... don't know how else to say it) and a choice with patent. Another stupid question is how to stop having the parent in this sample , so to return  to the "free choice".  Sorry for my bad English and for those ....stupid questions.....thanks again.

7 (edited by pavlenko.vladimir.v 2023-10-18 16:56:10)

Re: ParentComboBox

v_pozidis wrote:

Thank you... I need it because I like to have two choices for a search button.  A free choice (without parent... don't know how else to say it) and a choice with patent. Another stupid question is how to stop having the parent in this sample , so to return  to the "free choice".  Sorry for my bad English and for those ....stupid questions.....thanks again.

procedure Form1_cbA_OnChange (Sender: TObject);
begin
  if (Form1.cbA.ItemIndex > 0) then  Form1.cbB.dbFilter := 'id_a='+Form1.cbA.sqlValue else Form1.cbB.dbFilter := '';
  Form1.cbB.dbUpdate;
end;
Post's attachments

Attachment icon test.rar 4.03 kb, 56 downloads since 2023-10-18 

Re: ParentComboBox

Thank you all....great job

9 (edited by k245 2023-10-19 06:20:00)

Re: ParentComboBox

v_pozidis wrote:

See please the picture. Is there a way to do that by script ?

  frmMain.ComboBox2.dbParentCombo := 'ComboBox1';
Визуальное программирование: блог и телеграм-канал.

10 (edited by v_pozidis 2023-10-19 08:43:23)

Re: ParentComboBox

Hi k245 in case I like to cansel it ?
I do the following script but it doesn't work. Any idea???

if Form1.CheckBox5.Checked = true then
   begin
//with Parent
       Form1.ComboBox3.dbParentCombo := 'ComboBox2';
       Form1.ComboBox4.dbParentCombo := 'ComboBox3';
       Form1.ComboBox5.dbParentCombo := 'ComboBox4';
       Form1.ComboBox3.DoOnChange;
       Form1.ComboBox4.DoOnChange;
       Form1.ComboBox5.DoOnChange;
       Form1.CheckBox5.Caption:='Free search';

   end;

   if Form1.CheckBox5.Checked = false then
   begin
//Without Parent
       Form1.ComboBox3.dbParentCombo := '';
       Form1.ComboBox4.dbParentCombo := '';
       Form1.ComboBox5.dbParentCombo := '';
       Form1.ComboBox3.DoOnChange;
       Form1.ComboBox4.DoOnChange;
       Form1.ComboBox5.DoOnChange;
       Form1.CheckBox5.Caption:='Normal searh';

   end;

Re: ParentComboBox

try Form1.ComboBoxХ.dbUpdate for reload data in combo

Визуальное программирование: блог и телеграм-канал.

Re: ParentComboBox

k245 wrote:

try Form1.ComboBoxХ.dbUpdate for reload data in combo


thank's