Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 10 of 12 total |
Buttons not firing as expected ! |
Tue, Dec 19 2017 12:57 PM | Permanent Link |
kamran | Hi
I have an OrderFrm and a PrintFrm. From the OrderFrm I call the following buttons defined in PrintFrm: e.g. PrintReport1BtnClick(Sender); PrintReport2BtnClick(Sender); PrintReport3BtnClick(Sender); PrintReport4BtnClick(Sender); I am using a TBrowser to call an html file from each of the above buttons. However only the last seems to execute The ones before the last don't appear to fire ! Q. How do I ensure that all 4 buttons fire and do what they are supposed to do? (I only seem to be able to execute one of the buttons at any one time but not all four.) best regards Kamran |
Tue, Dec 19 2017 1:33 PM | Permanent Link |
Raul Team Elevate | On 12/19/2017 12:57 PM, kamran wrote:
> I am using a TBrowser to call an html file from each of the above buttons. Can you clarify what this means exactly in terms of what takes place ? > However only the last seems to execute This works fine here with blocking operations (each button logging something to multi line edit). Sounds on the surface like an async operation issue :- button1 calls browser load which is async so control returns right away and then button 2 gets called right away etc, Would need to understand better what those buttons do to comment further. Raul |
Tue, Dec 19 2017 2:17 PM | Permanent Link |
kamran | Hi Raul
1. So each button has code like this: click code for ReportBtn1: PrintBrowser.Url:='http://www.myweb.com:8080/reports/report1.html?FileName='+reportname1; click code for ReportBtn2: PrintBrowser.Url:='http://www.myweb.com:8080/reports/report2.html?FileName='+reportname2; etc.. 2. The report1.html, report2.html files read a text file using javascript and then send it to a printer for printing. Hope that helps. If you need further info please advise. Thanks Kamran Raul wrote: On 12/19/2017 12:57 PM, kamran wrote: > I am using a TBrowser to call an html file from each of the above buttons. Can you clarify what this means exactly in terms of what takes place ? > However only the last seems to execute This works fine here with blocking operations (each button logging something to multi line edit). Sounds on the surface like an async operation issue :- button1 calls browser load which is async so control returns right away and then button 2 gets called right away etc, Would need to understand better what those buttons do to comment further. Raul |
Tue, Dec 19 2017 3:16 PM | Permanent Link |
Raul Team Elevate | On 12/19/2017 2:17 PM, kamran wrote:
> 1. So each button has code like this: > > click code for ReportBtn1: > > PrintBrowser.Url:='http://www.myweb.com:8080/reports/report1.html?FileName='+reportname1; This is an async operation - your EWB code continues to run but the actual URL has not been loaded into yet. So this would be similar to just setting the URL 4 times in a row without letting browser to load anything so you end up with last URL loading only. Best suggestion i can make is to change this logic and rely on browser onLoad events to proceed to next step. Others might have better ideas but somethign simple could be this (actual implementation might be bit more complex based on your app logic): 1. create a stringlist in your report form 2. create a "browser loading" boolean flag on the printing form 3. when you need to load a URL you would do following > if "browser loading" is false then you set it to true and assign URL to briwser > if false you add url to the stringlist 4. whenever browser OnLoad fires it can check the stringlist > if there is a URL it would remove it and assign to URL > once stringlist is empty it can clear the "browser loading" Raul |
Tue, Dec 19 2017 6:40 PM | Permanent Link |
kamran | Thanks Raul - I will try that.
Cheers ! Kamran Raul wrote: On 12/19/2017 2:17 PM, kamran wrote: > 1. So each button has code like this: > > click code for ReportBtn1: > > PrintBrowser.Url:='http://www.myweb.com:8080/reports/report1.html?FileName='+reportname1; This is an async operation - your EWB code continues to run but the actual URL has not been loaded into yet. So this would be similar to just setting the URL 4 times in a row without letting browser to load anything so you end up with last URL loading only. Best suggestion i can make is to change this logic and rely on browser onLoad events to proceed to next step. Others might have better ideas but somethign simple could be this (actual implementation might be bit more complex based on your app logic): 1. create a stringlist in your report form 2. create a "browser loading" boolean flag on the printing form 3. when you need to load a URL you would do following > if "browser loading" is false then you set it to true and assign URL to briwser > if false you add url to the stringlist 4. whenever browser OnLoad fires it can check the stringlist > if there is a URL it would remove it and assign to URL > once stringlist is empty it can clear the "browser loading" Raul |
Wed, Dec 20 2017 7:37 PM | Permanent Link |
kamran | Hi Raul
Could you kindly clarify: I don't understand at what point the onLoad of a TBrowser is triggered. Is it triggered when a TBrowser is created OR when a URL is assigned to it ? OR at some other point ? So depending on this, am I not better to create the TBrowser on the fly when i need it and then assign the URL to ensure that it gets fired every time. Perhaps I have misunderstood this. Thanks Kamran |
Thu, Dec 21 2017 4:19 AM | Permanent Link |
Matthew Jones | kamran wrote:
> I don't understand at what point the onLoad of a TBrowser is triggered. > > Is it triggered when a TBrowser is created OR when a URL is assigned to it ? OR at some other point ? It happens when the page that the URL is set to is actually finished loading. So, you have a TBrowser. It is empty. You set the URL in your code, and your code keeps running. When your code stops doing anything, the TBrowser URL is actioned and the request is sent to the server. Some time passes while the internet passes your request. Your code is not doing anything. The server is awaking from its slumber. The content for the TBrowser starts to arrive. The content for the TBrowser completes and is ready. The OnLoad event fires so you can do the next part of your actions, and load something else, or whatever you want. -- Matthew Jones |
Thu, Dec 21 2017 11:19 AM | Permanent Link |
kamran | Thanks Matthew
That's very helpful to understand. Cheers Kamran "Matthew Jones" wrote: kamran wrote: > I don't understand at what point the onLoad of a TBrowser is triggered. > > Is it triggered when a TBrowser is created OR when a URL is assigned to it ? OR at some other point ? It happens when the page that the URL is set to is actually finished loading. So, you have a TBrowser. It is empty. You set the URL in your code, and your code keeps running. When your code stops doing anything, the TBrowser URL is actioned and the request is sent to the server. Some time passes while the internet passes your request. Your code is not doing anything. The server is awaking from its slumber. The content for the TBrowser starts to arrive. The content for the TBrowser completes and is ready. The OnLoad event fires so you can do the next part of your actions, and load something else, or whatever you want. -- Matthew Jones |
Thu, Dec 21 2017 12:37 PM | Permanent Link |
kamran | Hi Raul
So based on your suggestion is this code logic correct ? Global: BrowserLoading:=False; AllComplete:=False; URLList.Add(PrintBrowser.URL:='1xxxxxxxxxxxxxxxxxxxxxxxx'); URLList.Add(PrintBrowser.URL:='2xxxxxxxxxxxxxxxxxxxxxxxx'); URLList.Add(PrintBrowser.URL:='3xxxxxxxxxxxxxxxxxxxxxxxx'); ReportBtnClick: If (NOT BrowserLoading) AND (NOT AllComplete) then begin BrowserLoading:=True; PrintBrowser.URL:=URLList[0]; end; OnLoad: URLList.Delete[0]; BrowserLoading:=False; // process more.... PrintBrowser.URL:=PrintBrowser.URL:=URLList[0]; if URLList.Count = 0 then AllComplete:=True; Or Have I misunderstood something ! Cheers Kamran Raul wrote: On 12/19/2017 2:17 PM, kamran wrote: > 1. So each button has code like this: > > click code for ReportBtn1: > > PrintBrowser.Url:='http://www.myweb.com:8080/reports/report1.html?FileName='+reportname1; This is an async operation - your EWB code continues to run but the actual URL has not been loaded into yet. So this would be similar to just setting the URL 4 times in a row without letting browser to load anything so you end up with last URL loading only. Best suggestion i can make is to change this logic and rely on browser onLoad events to proceed to next step. Others might have better ideas but somethign simple could be this (actual implementation might be bit more complex based on your app logic): 1. create a stringlist in your report form 2. create a "browser loading" boolean flag on the printing form 3. when you need to load a URL you would do following > if "browser loading" is false then you set it to true and assign URL to briwser > if false you add url to the stringlist 4. whenever browser OnLoad fires it can check the stringlist > if there is a URL it would remove it and assign to URL > once stringlist is empty it can clear the "browser loading" Raul |
Fri, Dec 22 2017 3:56 AM | Permanent Link |
Matthew Jones | kamran wrote:
> So based on your suggestion is this code logic correct ? Looks okay to me. What exactly are you loading though - it doesn't seem to make sense right now as the browser will rapidly change and not give the user a chance to see what is shown. That may be fine of course... -- Matthew Jones |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Friday, September 13, 2024 at 03:42 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |