Jump to content

Pat Foley

Members
  • Content Count

    430
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Pat Foley


  1. I thought Remy mentioned using Add with a memo control. Here is a Sample using a nested procedure and a procedure with arguments that pass in controls that update the UI as needed.  This sample uses both Format and ToString to help show the logic in the  Controls as the program runs. 

    implementation
    
    {$R *.dfm}
    
    const
      BooleanOperators: TArray<string> = ['And', 'or', 'xor','NotAnd','NotOr'];
    
    var
      A, B, RC: Boolean;
    
    procedure TForm13.Button1Click(Sender: TObject);
    begin
      A := True;
      B := True;
      // filter the controls props here use nil or '' if control or string not made yet
      demo357Repair(Memo1.Lines, Listbox1.Items, nil, A, B);
    end;
    
    { TForm13 }
    /// <summary>
    ///  The TStrings of TMEMO are passed and requires a Memo1 and a Listbox1 to work
    ///
    /// </summary>
    procedure TForm13.Demo357Repair(const memoStrs, lbAItems, lbBItems : TStrings;var argA,argB: Boolean);
          // this flyover updates the value of RC each pass
          // how would you update A each time
          function flyoverCase(const Idx: NativeInt): Boolean;
          begin
            case Idx of
              0: Result := argA and argB;
              1: Result := argA or argB;
              2: Result := argA xor argB;
              3: Result := not argA or argB;     // adjust these to suit your schema
              4: Result := argA and not argB;
            else
              begin
                Result := False;
                memoStrs.Add('flyover needs attention');//surface errors
              end;
            end;
            // A := Result;
            // UX = User outputs
            memoStrs.Add( Format('%2s = %2s %s %2s', [RC.toString, argA.ToString(True), BooleanOperators[Idx], ArgB.ToString(False)]) );
            lbAItems.Add(RC.ToString);
            //how would you connect lbBItems
    
          end;
    begin
      for var I := Low(BooleanOperators) to High(booleanOperators) do
        RC := flyoverCase(I);
    end;

      

     

     


  2. 16 minutes ago, Vandrovnik said:

    My futile fight with toolbars in Delphi started with Delphi X?? and continues to this day. But I found a solution: I turned off all toolbars and left only the palette on top 🙂(To be honest, I did not try to enable any of toolbars in Delphi 12.2, so I am not sure that problems persist.)

    I like the extra one or two code lines showing gained by not showing them.  If only the debug pause button had a key. :classic_angry:


  3. 
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    1
    2 -- debugging started via F8. 
    3
    4
    5   
    6
    7 -- stop debugging after this. so if i press F8, debugging will not continue to step past it 7. // move to end
    8
    9
    end;// <== put break point here to stop loading the next block or unit use F9 to resume or f7 to enter

     

    By putting a trap at the end lets you use F9 to advance to trap to either move to next routine or F9 to run.  As the program is debugged these traps are last to remove.  


  4. On 9/11/2024 at 3:28 AM, Uwe Raabe said:

    BTW, also since I took over MMX there has been no one sending any usage report (perhaps it just works on my tests but not in the wild), so I don't have any numbers of what people use most or least. While I would not drop any features based on such numbers, they would give me some hints of MMX features that may just be unknown and lack some promotion.

    The feature I like best is the time loading metric when starting the IDE... Mostly the reading is 1728 if the reading is above 22xx I will restart the IDE several times to freshen the OS file MRUs/caches.  When the reading was 65xxx the machine was having a quota issue*.  It would interesting to compare MMX load time on different machines.  The tip of the day, refactor with and link-analyzer are used or useful.  Thanks for providing it.

     

    *Edge died off then and only D12 ran albeit no Co-Pilot :classic_sad:.  The next months windows update fixed the issue.    


  5. I had had some luck following these rules. 

    • Place only mature controls in the palette. 
    • If a control coding is changed just select Install that seems to tell the IDE to do the right thing.  Needs to be 32 bit to see install.
    • Any existing control needs removed from the designer view with ctrl X and the control gets the update as it pasted back in. This saves restarting the IDE.
    • Check the path of control ensure that it's codebase made the trip to 290  and not using a control that using a 11 or 280 codebase.  
    • Have a  sub project that allows the custom controls and forms to be compiled as standalone allowing modular construction getting custom controls working. then the main project uses the forms that have the controls placed on them.    

  6. 11 hours ago, dmitrybv said:

    C:\RADStudio\23.0\Bin\dcclinux64.exe -$Y- -$L- -$D- -B -NSData.Win;Bde;Vcl;Vcl.Imaging;Data;Winapi;System;System.Win;Datasnap;Xml;Xml.Win EhLib.Rtl.dpk Embarcadero Delphi for Linux 64 bit compiler version 35.0 Copyright (c) 1983,2022 Embarcadero Technologies, Inc. Linker command line: C:\RADStudio\22.0\Bin\ld-linux.exe -o bplEhLib.Rtl280.so -e _ZN5Ehlib3Rtl14initializationEv --gc-sections --version-script EhLib.Rtl.vsr -shared --no-undefined --export-dynamic -z noexecstack -z relro --build-id --eh-frame-hdr -m elf_x86_64 --dynamic-linker /lib64/ld-linux-x86-64.so.2 -s @EhLib.Rtl.lnk -lgcc_s -lrtlhelper_PIC -lc -ldl -lpthread -lz -l:bplrtl280.so -l:bplxmlrtl280.so -l:bpldbrtl280.so -rpath $ORIGIN Error: E2597 C:\RADStudio\22.0\Bin\ld-linux.exe: error: cannot find -lgcc_s  C:\RADStudio\22.0\Bin\ld-linux.exe: error: cannot find -lrtlhelper_PIC

    1. Read the "hints" on the error your compiling for "32" 64 with version 35.0 compiler switched to using a D11 path. I would say its a proj copied from d11 codebase to to a d12 codebase that kept the d11 proj guid.   

     


  7. Quote

    hr 10.006 chrome.exe docwiki.embarcadero.com/Libraries/Athens/e/load.php?debug=false&lang=en&modules=mediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.sectionAnchor%7Cmediawiki.skinning.interface%7Cskins.duobook2.styles&only=styles&skin=duobook2 - Google Chrome
    hr 10.069 Chrome_WidgetWin_1 Error: The parameter is incorrect
     

    My tool suspects the load.php? business most. We will see what happens.  


  8. 1.  form := GetParentForm(AControl);

    2. example  speedbutton click overridden to allow click to jump to control on another form. 

      TpfJumper = class(TSpeedButton)
      private
        FgotoName: string;
        FgotoControl: TControl;
        procedure SetgotoControl(const Value: TControl);
        procedure SetgotoName(const Value: string);
    //    procedure onclick;
    
      protected
        procedure Paint; override;
      public
        property gotoControl: TControl read FgotoControl write SetgotoControl;
        property gotoName: string read FgotoName write SetgotoName;
      published
        { Published declarations }
        procedure Click; override;
    
      end;

    3. The events for the Control. 

    Procedure TpfJumper.Paint;
    begin
      with Canvas do
      begin
        brush.Color := clMoneyGreen;
        Point(85,21),Point(17,0)]);
        polygon([Point(68,0),Point(68,7),Point(85,7),Point(85,34),Point(68,34),Point(68,41),                          Point(0,21),Point(68,0)]);
      end;
    end;
    
    procedure TpfJumper.click;
    begin
      inherited;
      gotoControl.Show;
    end;

    4.  In the designer you can assign several controls to one event.  In the handler cast the sender as needed.       


  9. On 8/15/2024 at 5:58 PM, Ian Branch said:

    BePatientWarningBoth;

    How about a second machine for the user.   They can view old work flows to gain insight on the work flows they are working on presently.  This second machine is simply left on so it doesn't need to download the "knowledge base" each time a user wants to know how a work flow was implemented last time. Since a second machine and screen is used you could charge additional license fees.  If the user can get more done each day by running a second application on second machine it should pay off since first machine used for work orders and IT work done concurrently on second machine albeit losing their "knowledge base" view when backing up.  In short, Historian functions adds a lot of overhead in bandwidth and screens!   


  10. 5 hours ago, Cristian Peța said:

    Also calling Abort into the constructor will destroy the form.

    How about         

    procedure TChangeForm.dostuff(inDBName, inDBTable, inTable: Variant)
    begin
    if not assigned(Changeform)  then Changeform := Tchangeform.create(Application); 
    //
    hookup up the incoming
    //
    
    end;

     


  11. Here's example of finger measure applied*.  The example refactored your code into a mypanel.  This code surfaces the numbers to aid in sizing.  *finger measure ~ 13 mm grid layout size.  I added a panel inside the ScrollBox

    unit Unit8;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.UITypes,
      System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ToolWin, Vcl.ComCtrls,
      Vcl.ExtCtrls;
    
    type
      TmyPanel = class(TPanel)
      const
        // 96 dpi ~  25.4 mm * 4
        baseFinger = 96 div 2;
        baseFatFinger = 3 * 96 div 2;
      public
        TopOffset: Integer;
        Finger: Integer;
        class var UsedHeight: Integer;
    
        procedure Paint; override;
        procedure WMSIZE(var message: TWMSIZE);
        procedure SetUp(AParent: TWinControl; const AColor: TColor;
          const Offset: Integer; const AAlign: TAlign);
      end;
    
      TForm8 = class(TForm)
        ScrollBox1: TScrollBox;
        ToolBar1: TToolBar;
        Button3: TButton;
        Button4: TButton;
        Button1: TButton;
        Panel1: TPanel;
        procedure Button4Click(Sender: TObject);
      end;
    
    var
      Form8: TForm8;
    
    implementation
    
    {$R *.dfm}
    
    // Let's pass ScrollBox1 using ScrollBox in SetUp procedure parameter}
    //var
    //  ScrollBox: TScrollBox;
    
    procedure TForm8.Button4Click(Sender: TObject);
    var
     panel : TmyPanel;
     TagNu: NativeInt;
     Prnt: TWinControl;
     Aln: TAlign;
    begin
      Prnt := panel1;//ScrollBox1;
      Aln := alTop;// alNone;
      panel := TmyPanel.Create(Self);
      TagNu := (Sender as TControl).Tag;
       Case Tagnu of
         0: panel.SetUp(Prnt,   clSkyBlue, 8, aln);
         1: panel.SetUp(Prnt,clMoneyGreen, 4, aln);
         2: panel.Setup(Prnt,     clCream, 2, aln);
       End;
    end;
    
    { TmyPanel }
    // Note how only current numbers are used and top offset used for naming not used for scrolling!
    procedure TmyPanel.Paint;
    begin
      inherited;
      canvas.TextOut(10,10,format('%s class Top %d Rect.Top %d',[Name, UsedHeight, BoundsRect.Top]));
    end;
    
    procedure TmyPanel.SetUp(AParent: TWinControl; const AColor: TColor; const Offset: Integer; const AAlign: TAlign);
    begin
      Parent := AParent;
      self.Color := AColor;
      ParentBackground := False;
      // moved top to here to avoid firsttime flag
      // and when align = alNone sets panel top else
      // size the parent to fit with resize event
      finger := baseFinger;
      Top := UsedHeight + 2 * finger;
      Inc(UsedHeight, (Offset+1) * finger);
      TopOffset := UsedHeight;
      AParent.Height := TopOffset;
      Name := 'MyPanel'+'_'+ UsedHeight.ToString;
      Caption := '';//Name;// + ' ' + UseCount.ToString;
      Height := Offset * finger;
    
      Left := 2 * finger;
      Width := 200;//aParent.Width - 34 - Left;
      Align := AAlign;
      show;
    //    if ScrollBox1.height > anOwner.Height div 2 then
    //    begin
    //      ScrollBox1.AutoSize := False;
    //      ScrollBox1.Height := anOwner.Height div 2;
    //    end;
    //e
    
    
    end;
    
    procedure TmyPanel.WMSIZE(var message: TWMSIZE);
    
    begin
      //Finger adjusted here
      finger := basefinger * {DPI/96} 1;
     end;
    
    end.

     


  12. procedure TForm23.PaintBox1Click(Sender: TObject);
    begin
       if Mouse.CursorPos.Y > 100 then exit;
    end;
    
    procedure TForm23.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
    begin
      if Y < 100 then dostuff
    end;

    Try an OnMouseOver event and perhaps a PtinRect for the cursor's xy position.


  13. I usually use notepad++ when touching the dfms as text. But for viewing you could do the following.

    • Select desired nest in design and copy. 
    • Open new Vcl form.
    • Paste selected controls on edit form
    • Adjust controls 
    • Paste adjusted controls back to source design window.
    • Make new unit an inline or embedded frame to reduce nesting in source form?

    Lazarus leaves the text view up once viewed as text but not really useful most of the time.  

     

      


  14. On 7/5/2024 at 11:33 PM, Liz said:

    I need help because they tell us that it is necessary to use a tabcontrol for the tabs.

    Tell they tabs Ok in IDE or XL spreadsheet viewed across a sizable monitor not for a phone! Set the tabvisible to False and use a Button captioned with '...' to show list that 'spins on touch'.

    show they the MultiviewDemo or TCardPanel for alternatives.

     

    Pat

     

     


  15. Assign the same mouse enter and mouse leave event for each of the controls in question.

     

    Looking at the .dfm as text we can see that the same mouse enter / leave event was manually set.

     

      object Rectangle1: TRectangle
        Position.X = 80.000000000000000000
        Position.Y = 232.000000000000000000
        Size.Width = 489.000000000000000000
        Size.Height = 177.000000000000000000
        Size.PlatformDefault = False
        OnMouseEnter = Panel1MouseEnter
        OnMouseLeave = Panel1MouseLeave
        object Button1: TButton
          Position.X = 128.000000000000000000
          Position.Y = 74.000000000000000000
          TabOrder = 2
          Text = 'Button1'
          TextSettings.Trimming = None
          OnMouseEnter = Panel1MouseEnter
          OnMouseLeave = Panel1MouseLeave
        end
        object Button2: TButton
          Position.X = 352.000000000000000000
          Position.Y = 70.000000000000000000
          Size.Width = 89.000000000000000000
          Size.Height = 27.000000000000000000
          Size.PlatformDefault = False
          TabOrder = 1
          Text = 'Button2'
          TextSettings.Trimming = None
          OnMouseEnter = Panel1MouseEnter
          OnMouseLeave = Panel1MouseLeave
        end
      end

    The following is assigned event.

     

    procedure TForm8.Panel1MouseEnter(Sender: TObject);
    begin
      Caption := 'Hovering over ' + TControl(Sender).name;
      Rectangle1.Fill.Color := TAlphaColorRec.Red;
    end;
    
    procedure TForm8.Panel1MouseLeave(Sender: TObject);
    begin
      Caption := 'Not hovering over ' + Rectangle1.Name;
      Rectangle1.Fill.Color := TAlphaColorRec.Green;
    end;

     

×