Topic: ComboBox Values

I tried to display appropriate combo box values. If I click on Add or Edit sale invoice button on form1, I wanted to display 'Sale' combo value in combo box Inv Type on Invoice form and so on.


Tried buttons after click and frmInvoice onShow events but both didn't work.

procedure Form1_btnPurchEdit_OnAfterClick (Sender: string);
begin
  frmInvoice.cbInvoiceDBCR.Text := 'Purchase';
end;

procedure Form1_btnPurchAdd_OnAfterClick (Sender: string);
begin
  frmInvoice.cbInvoiceDBCR.Text := 'Purchase';
end;


procedure Form1_btnSaleEditRefund_OnAfterClick (Sender: string);
begin
  frmInvoice.cbInvoiceDBCR.Text := 'Purchase Refund';
end;
....

procedure frmInvoice_OnShow (Sender: string; Action: string);
begin
  if Form1.btnPurchAdd.click then
  begin
    frmInvoice.cbInvoiceDBCR.Text := 'Purchase';
  end;
end;
..........

Ps/. I used Derek's custom line on combobox.


Please see the attached sample project if needed

Post's attachments

Attachment icon ComboBox Filter Custom Line etc.zip 15.28 kb, 310 downloads since 2017-05-25 

Adam
God... please help me become the person my dog thinks I am.

Re: ComboBox Values

Hi Adam,
Is this the sort of thing you're after?  (see attachment)
I've changed your code so that it triggers 'on click' rather than 'on afterclick' and also store which of the buttons has been clicked in a variable.
Derek.

Post's attachments

Attachment icon ComboBox Filter Custom Line etc.zip 348.77 kb, 351 downloads since 2017-05-25 

Re: ComboBox Values

Hi Derek,


Thank you very much......................
Truly appreciated..............................

Adam
God... please help me become the person my dog thinks I am.