Jump to content

Pat Foley

Members
  • Content Count

    439
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Pat Foley


  1. 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.


  2. 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.  

     

      


  3. 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

     

     


  4. 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;

     


  5. Alternate way.  Consider program schema to 'Broker' serving UI by listening to events

      

    In FMX you can use TControl where in VCL TWinControl usually needed. Meaning only deal with the components.  The broker or server of Application sits in a Datamodule.  This broker listens for User generated events and updates the Control UI in response. Also the broker updates the UI on timer events.     

     

    Using java style to find controls  ClassName 'TStringGrid' vs ClassType(TStringGrid) to find controls to assign the update.  The FMX allows forms considered as TControls where in VCL screen.formname is used to find form needed.          

     

    • Stream in the forms dfm Controls
    • change fixup~to bind the updates
    • Need less timers
    • Uwe's shows one cycle three deep on  a project with 30 forms 
    • Alex's graph works well too.     

  6. For Gilbert AZ,

     

    I would visit the local maker spaces and visit with the people in each to find possible people looking for full time work. 

     

      https://www.yelp.com/search?cflt=makerspaces&find_loc=Gilbert%2C+AZ

     

    The University down should have a space too.  Crash one of their job fairs for students looking for work or contact their placement office for candidates.

     

    Plan B: Conduct training sessions at one of these spaces to roll your own enlightened employee.

     

     

     

     

     

     


  7. I had a path issue to my mycontrolLibrary. I fixed by making a hard path to it. 

     

    Though this is on Windows and not ARM it still may useful.   Is check if the IDE can "see" the namespaces in uses clause by hovering over them.  If not try a syntax check or compile after manually loading unit not "seen" until the IDE shows the blue tag. After a few days the need to 'prime' the IDE went away and no more small empty blue tags.    

     

     

    Screenshot 2024-05-27 122034.png


  8. 55 minutes ago, Willicious said:

    When you say "pre-made", does this mean the items have to be pre-loaded, or can this be a blank tree which is populated when loading the program?

     

    If the former, then doesn't that mean a lot of manual text editing work for the user? If the latter, how does it differ from/improve on the current stock treeview?

    Pre-make may be a bad 'fork' 😞  

     

    Otherwise saving the treeview and and reloading the treeview could allow a game to be restarted at the level the game was when tree was saved. Rather than needing to play the game at lower levels each time starting the game.  Loading the game saved at higher level would save the users time.  Or  does the menu already have this feature?   


  9. What does the SetInfo do on the TV.onclick?       

     

    I populate my treeview childnodes by finding all the menuitems at startup. Then assign the menuitems onclick to the TV. The TV then follows the menu settings.  

     

    Emba has Space Rocks game on Getit.  Jim M uses a list to animate the rocks as they created and destroyed.      

     

    Treeview has savetofile and loadfromfile.   

     

    How is the game paused? is it ctrl- C? In the future pause the game not the IDE, insert a breakpoint, and restart the game. The IDE will then pause at breakpoint.   

     

      


  10. I didn't know about tabcontrols.  Just started styles last month. Here's my stab at  it using 'Tabber' for the symbol of the TabControl Sender vs 'control' and an assignable TStylefont enum.

     

    procedure TForm7.TabControl1DrawTab(Tabber: TCustomTabControl; TabIndex:
        Integer; const Rect: TRect; Active: Boolean);
    var
        TabStr:String;
        Pt : TPoint;
        R: TRect;
        TabUnderMouse:Integer;
        JohnFontcolorStyle: TStyleFont;
    begin
      with Tabber do
      begin
        Pt := ScreenToClient(Mouse.CursorPos);
        TabUnderMouse := IndexOfTabAt(Pt.X, Pt.Y);
    
        // Setting default font color to normal
        JohnFontcolorStyle := sfTabTextActiveNormal;
    
        if (TabUnderMouse = TabIndex) and Active then
          JohnFontcolorStyle := sfTabTextActiveHot;
    
        if Active then
          JohnFontcolorStyle := sfTabTextActiveNormal;
    
        if TabUnderMouse = TabIndex then
          JohnFontcolorStyle := sfTabTextInActiveHot;
    
        with Canvas do
        begin
          R := Rect;
          Font.Color := TStyleManager.ActiveStyle.GetStyleFontColor
            (JohnFontcolorStyle);
    
          if TabIndex = 0 then
            Font.Style := [fsStrikeout];
    
          TabStr := (Tabber as TTabControl).Tabs[TabIndex]; // ?
    
          Brush.Style := bsClear;
    
          DrawText(Handle, PChar(TabStr), Length(TabStr), R, DT_SINGLELINE or
            DT_VCENTER or DT_CENTER);
        end;
    
      end;

       

     

     


  11. uses
      Vcl.Forms,
               
      MyUnit, //From TrPartUnits.bpl, if remove, breakpoint works in win32 and win64
    
      AppForm in 'AppForm.pas' {Form2};
    
    {$R *.re

    Based on your info when the myunit is removed it compiles.

     

    Delphi 12 in debugger mode even with update often shows the dissembler first under a tab. To avoid compile the program and start the program using the browser in "attach to process" under the run button to start the executable and press f7-f9 buttons if hung up in the dissembler.  If blue dots not lined up with the source check path.  


  12. Quote

    ip 8: Seldom Use Form1 In Other Forms Even in the code of other forms, try to avoid direct references to global objects, such as Form1. It is much better to declare local variables or private fields to refer to other forms. For example, the main form of a program can have a private field referring to a dialog box. Obviously this rule becomes essential if you plan creating multiple instances of the secondary form. You can keep a list in a dynamic array of the main form, or simply use the Forms array of the global Screen object to refer to any form currently existing in the application. From Macro Cantu's Sidney 10.4 Handbook

    Reading between the lines means using a string for finding a form in runtime with the Screen.   Or Each Library should just launch its own forms or class var singleton form as needed.  


  13. program App;
    
    uses
      Vcl.Forms,
      MyUnit, //From TrPartUnits.bpl, if remove, breakpoint works in win32 and win64 = please don't put MyUnit here
      AppForm in 'AppForm.pas' {Form2};
    
    {$R *.res}
    
    begin
      Application.Initialize; //Breakpoint here: on win32 is ok, but 64 the breakpoint dont stop!
      Application.MainFormOnTaskbar := True;
      Application.CreateForm(TForm2, Form2);
      Application.Run;
    end.

    If myunit is available in a library, it can't also be in the program's dpr.  Access the Library myunit in each unit uses clause as needed! 

     

    If the unit uses clause doesn't see myunit adjust the path.  Putting my myunit in apps dpr will hide these issues and defeats the goodness of modular construction methods.    


  14. I try to use EM units say roughly a font of 72 would be one inch high, on a laser printer of 600 dpi you get one inch high lettering.    Using CSS you can set the sizing to show the ... when the ... rule is set. 

     

    Somehow windows can make small images when hovering over an icon or medium size images in task view.   What's neat the image is animated. 

     

    Now I just right-size the form and use units of "fat-finger" on custom control resize events.    This resize event helps on the 4k machines.

     

     

     

     

      

    Screenshot 2024-03-18 222616.png

×