Jump to content

SwiftExpat

Members
  • Content Count

    222
  • Joined

  • Last visited

  • Days Won

    9

Posts posted by SwiftExpat


  1. I think what you are looking for is this, declare a var to the type of the event.

    procedure TfrmRTCaddie.LicenseEditRefresh(const AValid: boolean; AInvalidReason: string);
    var
      ne: TNotifyEvent; //variable of event type
    begin
      ne := edtLicKeyCode.OnChange; //set the variable to the current onchagne
      edtLicKeyCode.OnChange := nil; //set on change to nil
     //work goes here
     
      edtLicKeyCode.OnChange := ne;  //asign the event hander back to the control event
    end;

     


  2. 2 hours ago, David Heffernan said:

    I wonder, how would a language exception raised by another module in your process appear as when it reach your exception handler?

    I believe this is what your asking for, something like this, focused on the else clause, adjusted for the faulting module. 

     

    "You can access the current except value via JSExceptValue in unit JS."

    "Note that this is only valid inside the catch-block. The compiler will not warn, if you use it outside. "

    Unit MyModule;
    Interface
    Uses SysUtils, Math, JS;
    Function DoIt(n: integer): double;
    Implementation
    Function DoIt(n: integer): double;
    var E: Exception;
    Begin
      try
        Result:=double(7.0)/n;
        if not IsFinite(Result) then
          if n=0 then
            raise EZeroDivide.Create
          else
            raise EOverflow.Create;
      except
        on EZeroDivide do Result:=0.0;
        on E2: EOverflow do Result:=0.0;
        else
          raise EAbort.Create('Something other: '+String(JS.JSExceptObject));
      end;
    End;
    End.

    Reference : https://wiki.freepascal.org/Pas2js_Transpiler#Translating_try..except

     


  3. 3 hours ago, Patrick PREMARTIN said:

    but beta testers (like me) can't check everything except projects we work on

    Agreed.

    5 hours ago, Lars Fosdal said:

    There also seems to be developers that write code that really is sub par, but no process that corrects it.

    That process is QP defects, but it is too late in the game. That is not fair to the developer (and should be planned for).

     

    As a beta tester I am testing with only a small time allocation, 1-2 hours per week. From my point of view, some focus to the beta cycle should be added to get the most out of beta testers. Establish coverage by dividing up focus groups by feature:

    • Allow me to choose 2-5 features I use in the IDE
    • Assign 1-2 features I use rarely but am familiar with

  4. I use this, you should be able to adapt for your use.  RootComponent is a TForm.

    Reference:

    https://www.fmxexpress.com/create-device-scaled-screenshots-in-delphi-xe5-firemonkey-on-android-and-ios/

    function TSERTTKRepoForm.ScreenShot: TTMSFNCBitmap;
    var
      lms: TMemoryStream;
      bmp: TBitmap;
      fScreenScale: Single;
      Surf: TBitmapSurface;
      function GetScreenScale: Single;
      var
        ScreenService: IFMXScreenService;
      begin
        result := 1;
        if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenService)) then
        begin
          result := ScreenService.GetScreenScale;
        end;
      end;
     begin
      lms := TMemoryStream.Create;
      try
        lms.position := 0;
        fScreenScale := GetScreenScale;
        bmp := TBitmap.Create(Round(TForm(RootComponent).Canvas.Width * fScreenScale),
          Round(TForm(RootComponent).Canvas.Height * fScreenScale));
        bmp.Clear(0);
        if bmp.Canvas.BeginScene then
          try
            TForm(RootComponent).PaintTo(bmp.Canvas);
          finally
            bmp.Canvas.EndScene;
          end;
        Surf := TBitmapSurface.Create;
        Surf.Assign(bmp);
        if not TBitmapCodecManager.SaveToStream(lms, Surf, '.png') then
          raise EBitmapSavingFailed.Create('Error saving Bitmap to png');
        Surf.Free;
        bmp.Free;
        lms.position := 0;
        result := TTMSFNCBitmap.CreateFromStream(lms);
      finally
        lms.Free;
      end;
    end;

     

    • Like 1
    • Thanks 1

  5. Willi,

    The behavior is expected if your code is hung, the IDE does not actually clean up the process. I wrote an IDE expert, but it is only for Delphi 10.3, 10.4 & 11.

     

    You can create a tool in the IDE to make killing the process simpler, see this thread, page 4 look for taskkill and then set the correct exe name to cleanup your project.

     


  6. 1 hour ago, Juan C.Cilleruelo said:

    a "correct" form of doing this?

    I will add a requirement that you want a stable deployment to test against, so that you can certify your software and have a basic support level matrix.

     

    I selected python embedded, so I know my python version is 3.9.x.  I then PIP installed the modules so the version of each module is known and can be tested to work.

     

    I then zip all of that up and deploy it as a sub-directory to my executable.

     

    Correct depends on what you believe you can support on the client system.


  7. This should get you started, I match mine by classtype.

      for i := 0 to Screen.FormCount - 1 do // itterate the screens
        if Screen.Forms[i].ClassType = TSERTTKMarshalForm then
        begin
          Screen.Forms[i].Show;
          if Screen.Forms[i].WindowState = TWindowState.wsMinimized then
            Screen.Forms[i].WindowState := TWindowState.wsNormal;
          exit;
        end;

     


  8. Someone had a similar question in the TMS forum recently and I thought the work around was a quick solution.

     

    Add columns (the work around was to hide the columns) to the tree view for each piece of data that is in your pointer. When you assign the pointer, copy the strings to the text of the columns.

     

    The TMSFNCTreeView in FNC UI Pack is JSON based, you can see if it fits your needs.

     


  9. 6 hours ago, H05 said:

    a problem for tomorrow

    This can be frustrating to understand, because technically your code works.

    4 hours ago, David Heffernan said:

    I think it's far more likely to be environment variables being inherited. 

    The comment above is right on point, your next step in isolating this should really be using SysInternals Process Explorer and use the Environment tab to examine the environment variables.  Compare the run from the IDE and from Windows explorer and then you know, based on the difference, what to set and what gets set from the IDE.

     

     

     

    • Like 1

  10. RunTime ToolKit Marshal version 2022.11.02 is available.

     

    New Features:
    Custom Inspectors can now be written based on class type. Sample for a TMS FNC Chart here Custom Inspector FNC Chart: https://github.com/SwiftExpat/RunTime-ToolKit/tree/main/Samples/FNCChart
    App Inspector component(non-visual) automatically starts Marshal and allows to re-open inspectors from last session.
    Object Plus now allows inspection of sub-components.

     

    Behavior change:
    Component properties that are components now open/switch to an inspector instead of an inline edit.

     

    Fixes:
    Frames correctly nested/expanded in navigation tree.

     

    Full release notes: https://swiftexpat.com/marshal/version.html

     

    Compiled demo for FMX and VCL here: https://github.com/SwiftExpat/RunTime-ToolKit/releases/tag/2022.11.02

     

    Live webinar on Nov 15, 2022 will demonstrate the new custom inspector, signup here: https://www.tmssoftware.com/site/tmswebacademy.asp?id=145

     

    Choose your level and see Marshal in action:

    Basic - Object Inspection:

    https://www.tmssoftware.com/site/blog.asp?post=1005

     

     

    Intermediate - Data Inspection:

    https://www.tmssoftware.com/site/blog.asp?post=1008

     

     

    Advanced - Custom Inspector for FNC Chart:
    https://www.tmssoftware.com/site/blog.asp?post=1014

     

     

    Any questions or feedback feel free to:

    1. comment on this post
    2. send me a message
    3. comment on Github
    4. comment on YouTube
    5. send an email
    6. and this list could be longer but should be enough to put a laugh in your day

  11. Visual Impact part 3 of 3 is available in the TMS blog and resumes with the story: Your presentation begins in 8 minutes and the dashboard can be enhanced using data labels on the chart. Marshal custom inspectors allow you to author your own inspector and shown is a custom inspector for a TMS FNC Chart.

    See the post here:Blog 3 of 3 Visual Impact

     

    On Nov 15, 2022 I will be presenting in a live webinar with TMS to show how Marshal can be used to solve some last minute issues with this dashboard and ensure a successful presentation.
    Register for the webinar: Webinar Registration

     

    Video summary:

     

     

    The compiled demo apps and source code are available here with a brief explanation about how they are built.

    https://github.com/SwiftExpat/RunTime-ToolKit/tree/main/Samples/FNCChart

     

    Please sign up for the webinar and join us to explore how Marshal extends your debugging options at runtime.

    I do appreciate feedback either here, GitHub, LinkedIn or email.

     

×