Jump to content

Gary

Members
  • Content Count

    128
  • Joined

  • Last visited

Posts posted by Gary


  1. It's easy to get confused at first. What ioan is saying the procedure "ShowSelectResults" or "ShowSelectedResults" you decide has to match. However, in the implementation section at the top inside your class TfrmDatabaseTutorial in the public section you do not use the class name just

    public
        { Public declarations }
        procedure ShowSelectedResults;

    Down below in the implementation section where you write your code you need the class name then a period then the procedure with exact spelling

    procedure TDatabaseTutorial.ShowSelectedResults();
    begin
      //code
    end;

    If you get rid of the class name from the implementation section and just leave "procedure ShowSelectedResults;" then with your cursor on the line press ctrl + shift + c Delphi will create the implementation section for you and you don't have to worry about spelling. 


  2. I use a similar approach as aehimself for Window programs with an addition I saw in a Holger Flick video.

     

    He created a very simple static TController class and replaced the .dpr code with a single line:

    begin
      TAppController.Run;
    end.

    This way you don't have to add code to the .dpr which I have had cause trouble in the past since Delphi edits this file as well. You can add code to the Run procedure and not worry about messing things up.

    TAppController = class
      public
        class procedure Run;
      private
        class function CheckSingleton: Boolean;
        class procedure SetFocusRunningInstance;
      end;
    
    class function TAppController.CheckSingleton: Boolean;
    begin
      Result := FindWindow(WINDOW_CLASS_NAME, nil) = 0;
    end;
    
    class procedure TAppController.SetFocusRunningInstance;
    begin
      ShowWindow(FindWindow(WINDOW_CLASS_NAME, nil), SW_SHOWMAXIMIZED);
    end;
    
    class procedure TAppController.Run;
    begin
        Application.Initialize;
        Application.MainFormOnTaskbar := True;
    
        if TAppController.CheckSingleton then
        begin
          //Add conditional defines,  splash screen whatever
         
          Application.Run;
    
        end
        else
        begin
          TAppController.SetFocusRunningInstance;
        end;
    end;

    Someone else (Can't remember where) also suggested setting the main form window to something unique  you need to override the CreateParams of the Main form.

    procedure TfrmMain.CreateParams(var Params: TCreateParams);
    begin
      inherited;
      StrCopy(Params.WinClassName, WINDOW_CLASS_NAME);
    end;

     

    • Like 2

  3. Hello all,

     

    Anyone else have this problem? I get a quote from Embarcadero for my renewal with a link. Go to link fill in all information and press submit or whatever. I get a failed message, and the link no longer works because it actually went through, at least the charge did. Embarcadero has no record of payment but My card company cleared the transaction March 1st 7 days ago. I had the same problem last year and complained to Embarcadero. Just wondering if it's just my issue or has anyone else had issues with online subscription renewal?


  4. Once again Embarcadero's licensing policy causes pain!! 11.3 is out so I cleaned up the 2 computers I have Delphi installed, one with a complete reinstall of Windows, however something I have been wanting to do for some time is rename both from the stock unintelligible names. I did contact support about this in advance and since I'm on contract, they told me no problem. Took today off for this big install -- Registration limit exceeded!! I did email support for a bump but have a totally wasted day, and who knows how long it will take? BTW just paid ransom yesterday, expires on the 12th.


  5. @salvadordf

    I figured it was a matter of drilling down to the element.

    3 hours later after much trial and error, Success!!

     

    Quote

    procedure TfrmLocation.actRefreshReportExecute(Sender: TObject);
    begin
      WVBrowser.ExecuteScript('iframes = document.getElementsByTagName("iframe");'+
      'iframes[1].contentWindow.document.getElementById("linkRefresh").click();');
    end;

    So frustrating spending so much time for what you already know is going to be 1 or 2 lines of code because of your ignorance but satisfying when done.

    Thank you so much.

    • Like 1

  6. Delphi 11.2 WebView4Delphi

    Hello all,

    I posted on StackOverflow yesterday, but no solution, probably because this seems to be such an easy fix.

     

    I am totally new to Web/JavaScript programming and just need to refresh and download a csv file from a geo location service every half hour.

    I have everything working except what should be the easiest part, simply clicking the refresh button on the page.

     

    I am using an ActionList and menu to test each step for now. What I have so far:

    A running app that can navigate to the site, open the report, and download the file to a Nas drive overwriting the previous file. The download logs when finished.

     

    Before downloading I need to refresh the report. If I inspect the element in the browser it takes me to this list item:

     

    <a id="linkRefresh" href="#" class="tools refresh report-action" data-action="refreshReport" data-event="click"> <span class="report-edit-icon refresh"></span> <span class="tool-label">Refresh</span></a>

     

    In my test action I have this code:

    procedure TfrmLocation.actRefreshReportExecute(Sender: TObject);
    begin
      WVBrowser.ExecuteScript('document.getElementById("linkRefresh").click()');
    end;

    Nothing happens, is there something I'm missing? Is there an easier way to do this? Is there a way to verify that a valid element is being returned? Can there be more than one document in the page, this button is inside a frame with a #document element?

     

    I have spent 2 days on this so far, any help would be appreciated.

     

     

     

    Screenshot 2023-01-25 142655.png


  7. Hello all,

     

    I have an app that dynamically changes the style. On close it saves style to ini and reloads on startup.

    Changing style and closing is fine with any style except if the app has changed style to windows. App crashes after writing to ini, so if app starts with windows style and closes without changing all is fine. I logged the OnClose of the Main form and get no errors.

    Debug shows the problem in the TStyleEngine.DoUnregisterStyleHook call and jumps to System here:

     

    function _IsClass(const Child: TObject; Parent: TClass): Boolean;
    begin
      Result := (Child <> nil) and Child.InheritsFrom(Parent);
    end;

     

    I have included the EurekaLog file.

     

    Any help?

    Gary

    EurekaLog.txt


  8. @jonnyg You're correct, I should have been clearer. I just run the latest version of Delphi but have some components that the update has expired as well as open-source components I no longer use. I did buy a Windows 11 license and install Delphi and the needed components to support my old app. All seems to work well. The only problem I have had is the VM will lock up at times requiring a reset.


  9. Hello all,

     

    I am going to do a clean install of Delphi but don't want to install all the old components that I no longer use. I still need them to support legacy apps, so want to try loading up a VM with those components. 

    What are you using for VM, and what settings work best?

    My current Machine:

    11th Gen Intel(R) Core(TM) i7

    32 GB Ram

    1 TB SSD

    Windows 11

    Delphi 11.2

     

    I would also like to run it on an older laptop

    10th Gen i7

    16 GB Ram

    1 TB SSD

     

    Or is there a better way to support old apps that use components who's license has expired?


  10. @Programmer..

    I think I will take this opportunity to do a clean install. This is a secondary machine(Laptop) that has a lot of old components I keep on it to support Legacy apps. I have been wanting to move them to a VM, so this will give me a chance to experiment with that.

    I'll open a new topic for VM suggestions, the latest discussion I could find was from 2019

     

    Thanks for the help[


  11. Hello all,

    My styles have disappeared from the IDE, and now projects will not compile. I get an intermediate .vrc file with the error cannot find file on this line:

     

    IcebergClassico VCLSTYLE "c:\\program files (x86)\\embarcadero\\studio\\22.0\\bin\\22.0\\Styles\\IcebergClassico.vsf"

     

    The files are where they are supposed to be in  C:\Users\Public\Documents\Embarcadero\Studio\22.0\Styles not the above.

     

    This happened after Delphi asked to update my path for run time packages (I'm not currently using run time packages). How do I point the IDE to the correct location.

     

    Thanks


  12. Agreed, however this is a small company with 4 users in 2 offices next to each other over a LAN connection. Leaving for lunch has happened 🙂. When they return their co-worker looks across the desk and says "Quit doing that". Handled!

    Seriously though I also read posts about "Ghost" locks, not sure what they are, but sounds as if a problem occurs while the record is locked it could leave the lock in place indefinably.

     

    Recently they did a price increase, several times they ended up editing the same record in Quickbooks (much bigger program than mine). When they would try to post the record they would immediately get a message telling them to try again. They have asked me to do the same. Simply checking if the record is being edited by someone else, either before editing or posting seems like an easy fix, until you try to implement it.

     

      


  13. More correctly the DataSet could have other record locks, but the BeforeEdit would know the record in question. If not then instead of is DataSet.locked it would be if CurrRecord.Locked or the substance of.

×