Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 10 of 11 total |
Problem returning some data |
Fri, Feb 9 2018 2:30 AM | Permanent Link |
Paul Coshott | Hi All,
I must be missing something really simple, but i can't see it. I have a simple form that has a panel on it. On this is a grid, a TDataSet and 2 buttons. The grid has it's datasource property set, and the one column is set to the field "Description". This is not the main form. A form that has been shown with ShowModal is calling it with ShowModal. When the form is shown, it displays the "loading job data..." message, but it never finishes and the data never loads into the grid. The query works correctly, and the gblCompanyId is correct. Can anyone see anything wrong? Cheers, Paul ------------------------------------------------------------------------------------------------- unit JobSearch; interface uses WebCore, WebUI, WebForms, WebCtrls, WebCtnrs, WebGrids, WebBtns, WebData; type TfJobSearch = class(TForm) pMain: TPanel; gJobs: TGrid; bOK: TButton; bCancel: TButton; dsJobs: TDataSet; GridColumn2: TGridColumn; procedure fJobSearchShow(Sender: TObject); function dsJobsBeforeLoad(Sender: TObject): Boolean; procedure dsJobsAfterLoad(Sender: TObject); private { Private declarations } procedure ShowLoadProgress; procedure HideProgress; public { Public declarations } end; var fJobSearch: TfJobSearch; implementation uses Main; procedure TfJobSearch.ShowLoadProgress; begin Application.Surface.ShowProgress('Loading Job Data...'); end; procedure TfJobSearch.HideProgress; begin Application.Surface.HideProgress; end; procedure TfJobSearch.fJobSearchShow(Sender: TObject); begin dsJobs.Close; with dsJobs do begin Params.Clear; Params.Add('CompanyId=' + (IntToStr(gblCompanyId))); Database.LoadRows(dsJobs); end; gJobs.SetFocus; end; function TfJobSearch.dsJobsBeforeLoad(Sender: TObject): Boolean; begin ShowLoadProgress; end; procedure TfJobSearch.dsJobsAfterLoad(Sender: TObject); begin gJobs.Dataset := dsJobs; HideProgress; end; end. |
Fri, Feb 9 2018 3:37 AM | Permanent Link |
Chris Holland SEC Solutions Ltd. Team Elevate | Hi Paul,
I would add an event for OnLoadError() and see if it catches an problems. Chris Holland [Team Elevate] On 09/02/2018 07:30, Paul Coshott wrote: > Hi All, > > I must be missing something really simple, but i can't see it. I have a simple form that has a panel on it. On this is a grid, a TDataSet and 2 buttons. The grid has it's datasource property set, and the one column is set to the field "Description". This is not the main form. A form that has been shown with ShowModal is calling it with ShowModal. > > When the form is shown, it displays the "loading job data..." message, but it never finishes and the data never loads into the grid. The query works correctly, and the gblCompanyId is correct. > > Can anyone see anything wrong? > > Cheers, > Paul > > ------------------------------------------------------------------------------------------------- > > unit JobSearch; > > interface > > uses WebCore, WebUI, WebForms, WebCtrls, WebCtnrs, WebGrids, WebBtns, WebData; > > type > > TfJobSearch = class(TForm) > pMain: TPanel; > gJobs: TGrid; > bOK: TButton; > bCancel: TButton; > dsJobs: TDataSet; > GridColumn2: TGridColumn; > procedure fJobSearchShow(Sender: TObject); > function dsJobsBeforeLoad(Sender: TObject): Boolean; > procedure dsJobsAfterLoad(Sender: TObject); > private > { Private declarations } > procedure ShowLoadProgress; > procedure HideProgress; > public > { Public declarations } > end; > > var > fJobSearch: TfJobSearch; > > implementation > > uses Main; > > procedure TfJobSearch.ShowLoadProgress; > begin > Application.Surface.ShowProgress('Loading Job Data...'); > end; > > procedure TfJobSearch.HideProgress; > begin > Application.Surface.HideProgress; > end; > > procedure TfJobSearch.fJobSearchShow(Sender: TObject); > begin > dsJobs.Close; > with dsJobs do begin > Params.Clear; > Params.Add('CompanyId=' + (IntToStr(gblCompanyId))); > Database.LoadRows(dsJobs); > end; > gJobs.SetFocus; > end; > > function TfJobSearch.dsJobsBeforeLoad(Sender: TObject): Boolean; > begin > ShowLoadProgress; > end; > > procedure TfJobSearch.dsJobsAfterLoad(Sender: TObject); > begin > gJobs.Dataset := dsJobs; > HideProgress; > end; > > end. > |
Fri, Feb 9 2018 4:06 AM | Permanent Link |
Paul Coshott | Chris Holland wrote:
> I would add an event for OnLoadError() and see if it catches an problems. Hi Chris, Thanks for the answer. I did that (also for the columns load error too), but no error. I have attached a screenshot of the form running. Cheers, Paul Attachments: load_data.jpg |
Fri, Feb 9 2018 4:26 AM | Permanent Link |
Matthew Jones | Paul Coshott wrote:
> Chris Holland wrote: > > > I would add an event for OnLoadError() and see if it catches an problems. > > Hi Chris, > > Thanks for the answer. I did that (also for the columns load error too), but no error. I have attached a screenshot of the form running. > > Cheers, > Paul Time to hit F12 and put in some breakpoints and watch the network traffic I think. -- Matthew Jones |
Fri, Feb 9 2018 5:56 AM | Permanent Link |
Uli Becker | Paul,
please check if procedure TfJobSearch.dsJobsAfterLoad(Sender: TObject); is executed at all (put a messagebox there). Uli |
Fri, Feb 9 2018 7:16 AM | Permanent Link |
Paul Coshott | "Matthew Jones" wrote:
> Time to hit F12 and put in some breakpoints and watch the network traffic I think. Hi Matthew, I haven't done this before. Can this be done in the ide or do I have to run the web app in an external browser? Can you point me to what I should read up on in the manual? Cheers, Paul Uli Becker wrote: > is executed at all (put a messagebox there). Hi Uli, I added a ShowMessage, and nothing. It never gets to the after load event. Cheers, Paul Uli |
Fri, Feb 9 2018 7:49 AM | Permanent Link |
Uli Becker | Run your app on localhost in Chrome, press F12 and see what's going on in the network tab.
|
Fri, Feb 9 2018 8:34 AM | Permanent Link |
Matthew Jones | Uli Becker wrote:
> Run your app on localhost in Chrome, press F12 and see what's going on in the network tab. And then, look at the sources for your .js file. You will find it remarkably easy to work out the match between the two. -- Matthew Jones |
Sat, Feb 10 2018 2:03 AM | Permanent Link |
Paul Coshott | Fixed!! I was using the DataSet's BeforeLoad to ShowLoadProgress, but this routine is a function and requires a result of true to continue.
All I needed was Result := True; and it's working. Thanks for all the help guys. Really appreciate it. Cheers, Paul |
Sat, Feb 10 2018 9:22 AM | Permanent Link |
Frederick Chin | Paul Coshott wrote:
/* Fixed!! I was using the DataSet's BeforeLoad to ShowLoadProgress, but this routine is a function and requires a result of true to continue. All I needed was Result := True; and it's working. */ I think that functions without return values should be flagged as errors by the compiler and the program should not be allowed to run. The calling procedure/function of the function can use or ignore the return result but the called function should return a value, always. It is just to easy to miss specifying a return value especially from a person coming from Delphi and this can cause "how did I miss that?" situations and head scratching as to why seemingly valid code fails. The OnKeyDown event is a perfect example. -- Frederick |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Friday, March 29, 2024 at 03:30 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |