Jump to content

Official Call Example Application Data between two forms


asapltda
 Share

Recommended Posts

Official Call Example Application Data between two forms :
 
Good morning , this is to request a sample that is very common in the forum.
1. The common procedure is that a generic form is called from another form MainForm Example
 
Two . The Generic Form display the information in a table which is required to obtain a code . example QueryForm
 
Three . In the MainForm form is required to consult the table of Cities , the required code must be entered in field TEDIT .
 
April . Button to see the list of cities is pressed, the program calls the QueryForm.showmodal shape and should expect the user to select the city code , when the user selects the city should receive the selected value and place it on the field TEDIT
 
I have seen several example callback , but in the process in many ways consulting many fields of many different tables are required and requires reuse the code , so I solicto detailed to do this example and if I may suggest is part of the examples official
 
PS In my case in the normal VCL believes tedit a derivative of a function executing this component and thus saving a lot of work
 
Salute and thank you for your attention
 

 

  • Upvote 1
Link to comment
Share on other sites

  • 1 year later...

Hi logisticasoft,

Just struggling with this exactly as you mentioned.

This is an all day VCL operation, but causing me some new white hair in UniGui.... any ideas?

 

Well, I went to fast in my reply, just saw Form callback demo. 

Link to comment
Share on other sites

Hi to all,

 

if I understand well there is a need for a form displaying some data from a query and then the selected value returns to a tedit in the main form.

For this I've made a dialog form that when I call it I pass the query that produces the results and then I return the value that I want using modal result.

Correct me If I don't understand well.

Link to comment
Share on other sites

  • 1 month later...

see exemple:

procedure TfrmClientesProspecao.btnpesqClienteClick(Sender: TObject);
begin

 

frmMyFind.ShowModal(

                   procedure (Sender:TComponent;Resp:integer)
                     begin
                       if resp=1 then
                         begin
                         qOcorrenciaCodCliente.AsInteger  :=strtointdef(SeparaResult(UniMainModule.global_UtimoRetornoPesquisa,1,'|'),0);
                         qOcorrencianomefantasia.AsString :=separaResult(UniMainModule.global_UtimoRetornoPesquisa,2,'|');
                         end;
                     end
                     );
 
 
procedure TfrmMyFind.btnOKClick(Sender: TObject);
begin
UniMainModule.global_UtimoRetornoPesquisa :=qFind.fields[0].asstring+'|'+qFind.fields[1].asString;
ModalResult :=mrOk;
close;
end;

 

 

end;

Link to comment
Share on other sites

  • 2 months later...

You definitely can do from the closing of the search form

 

type
  TfrmCourseSearch = class(TUniForm)
   ...
  private
    procedure SetCourseOfferID(OfferID: integer);
    function GetCourseOfferID: integer;
    procedure FilterCourse(editComponent: TUniEdit; FieldToSearch : String);   
  public
 
    property OfferID: integer read GetCourseOfferID write SetCourseOfferID;
  end;
 

//----

procedure TfrmCourseSearch.UniFormClose(Sender: TObject;
  var Action: TCloseAction);
begin
     if ModalResult = mrOK then
     begin      
        frmCourseEnrollment.cdsRegistrationDet.Edit;
       frmCourseEnrollment.cdsRegistrationDetCSOFFERINGID.value := frmCourseSearch.OfferID;
       frmCourseEnrollment.cdsRegistrationDet.Post;     
      end else    
        ShowMessage('You cancelled the search');        
end;
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...