Jump to content

Pat Foley

Members
  • Content Count

    378
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Pat Foley


  1. 17 hours ago, m_pell_98037 said:

    Perhaps I should use subs.

    If subroutines mean procedures and functions also lists arrays and what not.   Marco Cantu has some free books out there.  Delphi has help built in plus source.

     

     

     

    For now take a Tshape and drop it in the design window.   Use the F11 key to change the Brush and Pen Properties this makes a nice card back.  

    In code window find Shape1: TShape; Hold down the control<key>to underline TShape then cllick on it.  This coding allows the Tshape to be made. Study how the paint works with pen and brush. 

     

    Calendar1: TCalendar;  Is another one that shows how change properties and a grid as well.  You not needing to make a control now just examine the plumbing.      

     

     


  2. Quote

    But, when building my application in debug mode I only get 1 hint. When building in release mode I get more hints. 

     

    DCUs are only recompiled when they are not found or a build all command is sent. Delphi may be doing this for you each time you switch from Debug to Release.

     

    If they are not recompiled no hints are generated.  Allowing faster compile times 🙂


  3. 11 hours ago, emailx45 said:

    The man is born a child ... he needs the care of those who were already here.
    The man gets old ... and continues to need those who will live here.

       From diaper to diapered.   What happens in between is accommodation by family, teachers, management, and the State.  A good manager accommodates his charges needs.  Consider the companion animal needed not needed.  I mentioned to the boss of all the shops I worked at this was the only shop that did not have pets.  More toilets can't be installed since the State requires new toilets to meet  accommodation laws. 

     

      The cost of Knowledge is angst.  Being able to share knowledge eases that angst  

     

        


  4. Quote

    It makes me wish I had another 20-30 years to work just to see where this could lead.

    You could. Deming worked on papers and was to present one at 92.   

     

    Jerry Pournelle when he worked in the Aerospace industry said they hired people of lower intelligence to connect the wiring harnesses in airplanes since they could focus on this mind numbing work and were happy to do it. 

     

    I was at a conference at a state where a company interned high teachers vs students so the teachers would know what to teach and the importance of the students knowing communication skills.  The goal is educate locally not pay finders fees and bonuses for someone that's homesick no matter what the bonus is. 


  5. procedure TForm1.btnuseListUXClick(Sender: TObject);
    var
      trianglePts: TtrianglePts;    //           Tlist of <Points>
      trianglePtsExtended: TtrianglePts;
    begin
      trianglePts := TtrianglePts.Create;
      trianglePts.Add(point(20,20));
      trianglePts.Add(point(200,100));
      trianglePts.Add(point(200,20));
      trianglePts.Add(point(20,20));
      Canvas.Pen.Color  := clgreen;
      Canvas.Polyline(trianglePts.List);
    
      trianglePtsExtended := TtrianglePts.Create;
      trianglePtsExtended.AddRange(trianglePts.ToArray);
      trianglePtsExtended.insert(1,point(20,100));
      Canvas.Pen.Color  := clRed;
      Canvas.Polyline(trianglePtsExtended.toarray);
    
      trianglePtsExtended.Free;
      trianglePts.Free;
    end;

    forgot generic example.

      TtrianglePts = TList<TPoint>;

  6. type
      ToldschoolArray = TPointerList; // array of pointer
      TusesSetlengthinternallyArray = TList;
      TtrianglePts = TList<TPoint>;
    ...
        
    procedure TForm1.btnmakeArrayClick(Sender: TObject);
    var
      oldSchoolArray: ToldschoolArray;
      things: TusesSetlengthinternallyArray;
      I, X, Getby: Integer;
      viewI, viewM: Integer;
      pI: PInteger;
    const
      bestguess = 10;
    begin
      x := random(10)-4;
      things := TusesSetlengthinternallyArray.Create;
      things.Capacity := bestguess;
             // ^setting may increase speed when 10000 + coming
      Try
        for I := 0 to pred(bestguess+x) do
        begin
          new(pI);
          pI^ := I;
          things.Add(pI);
          //oldSchoolArray.add(pI); can't do this :(
        end;
    
        oldSchoolArray := Things.List; // I was wondering why they added .list
        ViewI := PInteger(Things.Last)^;  // guessing generics helped add this goody:)
        Getby := bestguess + X - 1;
        ViewM := PInteger(oldSchoolArray[Getby])^;
        caption := 'Easy:' + viewI.tostring + ' Hard:' + viewM.tostring;
      Finally
        for I := 0 to things.Count - 1 do dispose(things[I]);
        things.Destroy;
      End;

    Older School would be slice with oversized fixed array.    To avoid DynaArray use D3.    


  7. On 12/12/2020 at 7:26 PM, David Schwartz said:

    Maybe this helps:

     

    "Because they are not good at looking at things from the listener’s point of view ... mismatch between what they want to say and the topic at hand.

    Roberson, Kenneth. Adult Asperger's Syndrome: The Essential Guide 

    ...

     

    Boy,

    I hope not. WOW that is spot on diagnosis I thought it was simply a setting boundaries issue mixed with Irish Alzheimer's 'just able to remember who to hold a grudge against.' But I will work on active listening skills where both the speaker and listener learn from the conversation. Thanks.

    .
    My suggestion for you is sell the goodness of an improved codebase to the boss who tells marketing boss to offer improved product to customers who may be getting approached by unscrupled vendors. These customers may be getting an itch by a vendor to move to 'new' stuff and conversations with the customer about your company's 'new' ointment is needed. Can any work being done now use overloaded procedures being passed (enlightened) allowing existing procedures to keep being passed(deprecatedrD7) 

     

    For me I should have asked are the circular references caused by a tabsheet management routine or is it needing something like shared DataModule. Only if the former should I have mentioned using Tcontrols and adding the custom Component coding horror I presented as example of reducing circular references.  Also my control is an example of leaving argument names from a refactor into a control.  

     

    The caveat on controls is a published property like gotoControl can't be renamed maketopwindowControl without breaking old source in old D.  New D simply doesn't allow the design window to show but it will compile it.  The bigger issue should a control show everything like a treeview or hide everything like a menu. In runtime tabsheets are only showing when selected. Showing all the tabs is needed only in design. In runtime only one please. The user walks thru the tabsheets with treeview using keyboard keys. CRUD and back/next buttons can be added. Launch another instance of the program with inifile data shows the state of the program a year earlier.  Right clicking on task bar set instances windows side by side or stacked that should answer the first question.      


  8. 22 hours ago, David Schwartz said:

    Yeah, that probably fits.

    ...

     

    Sorry, sometimes I do tend to ramble. 

      I like to write code as if I am presenting to group of 5 to 10 people. Considering what each person would comment or smirk or nod with. (old guys said C tick for ;  )    
       
       Here we need a navigator class that finds things and saves the view and url in that view. It would be like the finder in the Macintosh or find on your newer D10 palette.


       Also how many of your jobs have a F1 thru F12 spec. that each view has twelve buttons to navigate with? A. pull navigation off What is the fix to keep these buttons working when a view is removed? A. Show only controls that work.
       
       This outline uses the Vcl.Forms.screen  to iterate thru all forms and uses findcomponent to get a reference for bookmarks. The screens object is windows business we are bypassing the need to know much about the forms in the application and use Tcontrol on back side for showing the object.  Windows will show each tab properly when the show event is fired from Menu or button.     
     


    outline of test
    1.     Make a browser form that has a addressbar and assign drag drops   

    2.     At runtime create browser forms and set the parent to each tabsheet set dropdrop too!
    2.1    Add a menu // for the mice less plus possible shortcut keys
    2.3    add tree node // untested plus 

    3.    At runtime populate a flow panel with bookmark objects

    4.   drill into tabs look at stuff. 
    5.   drop  bookmark on stuff. // enddrag here sets text, form name, controlname.  

    6.   Stream the bookmarks to a save file these bookmarks have properties to hold the address bar text and the formname and parent
    7.   Next runtime the saved bookmarks are loaded into the flow panel when needed. 

    8.    The code to iterate the screens and controls and assigns found form,parent to a reference.
    8.1   The bookmark click event is assigned 
           refformParent.show//   as long as the form is not minimized this shows whatever it takes to show the control. 
           refformParent.focus// 
    8.2  good time to assign drag drop stuff to buttons that should work across the whole app            
    9    I would have the navigator as the main form because the forms are so readily surfaced this way.

     

    oops screens is the name of the menu handler--here is example adding a goto for the enduser.

    this is runtime loaded from inifile  Note click assigned in here as well

     

    Purpose  jump to another form panel. 

    procedure addGotos(slGoto: Tstrings);
    var
      ii,ss: integer;
      slDetail: Tstrings;
      aGoto: Tpfjumper;
      AformName: string;
      aForm,firstform: Tform;
      aPanel: TPanel;
      agotoName:string;
      aGotoControl: TControl;
    begin
      slDetail := TStringList.create;
      for ii := 1 to slGoto.Count - 1 do
      begin
        firstform := nil;
        aGotoControl := nil;

        slDetail.CommaText := slGoto[ii];
        agotoname := slDetail[5];
        aformName := slDetail[0];
        for ss := 0 to Screen.FormCount - 1 do
        begin
          aForm := Screen.Forms[ss];
          if not assigned(firstForm) and (aform.name = aformName) then 
          begin
            firstForm := AForm;
            //since we have panels with the same name we find the appropriate panel
            //when the form is found  
            aPanel := firstform.findcomponent(slDetail[1])as TPanel;
          end;
          if not assigned(aGotoControl) then
           agotocontrol := aForm.FindComponent(agotoName)as Tcontrol;
          if assigned(aGotoControl) and assigned(firstForm) then
          begin
            // saves passes the panel for the jumpstation the gotocontrol knows
            // its owner and parent
            aGoto := TpfJumper.Create(Aform);
            with aGoto do
            begin
              Name := slDetail[2];
              Left := strtoint(slDetail[3]);
              Top  := strtoInt(slDetail[4]);
              width := 80;
              height := 44;
              //Caption := Name;
              hint := Name;
              Flat := True;
              onclick := firstform.onClick;
              gotoControl := aGoToControl;
              parent := aPanel;
              break;
            end;
          end;
        end;
      end;
      slDetail.Free;
    end;
     

     

    Pat


  9. procedure TSparks.drawSparksE;
    var
      h, x, w, y, PtsIndex: integer;
      dataPos, startPos: integer;
      Xofs, widthDelta: double;
      CP: TChartPoint;
      //arPts: array[0..maxChart] of TPoint;    // had to remove - 1 for thing to work
      arrPts: Array of TPoint;
    begin
      with A1Canvas do
      begin
        Brush.Color := clnavy;
        startPos := SparkPos;
        if sparkPos = 0 then
        begin
          Brush.Color := clcream;
          fillRect(Rect(0,0,220,220));
          SparkPos := cmaxChart - copenChart;
         /// StartPos := 0;
        end;
        assert ((Sparkpos - StartPos + 1) > 0);
        setlength(arrPts,Sparkpos - StartPos + 2);
        h := image.Height;
        w := image.width;
        widthdelta := w/cmaxchart;
        Xofs := widthdelta/2;
        for PtsIndex := low(sparkers) to high(sparkers) do
        begin
          CP := Sparkers[Ptsindex];
          y  := round (h * (CP.span - CP.data^ - CP.Zero)/(CP.span - CP.Zero));
          CP.lastY[dataindex] := y;
          for DataPos := StartPos to SparkPos + 1 do
          begin                      /// ^ polyline needs two points
            x := round(Xofs + dataPos * widthDelta);
            if way = -1 then
            x := w - x;
            arrPts[dataPos - startpos].x := round(x + Xofs * way);
            arrPts[dataPos - startpos].y := CP.lastY[(DataIndex + dataPos - sparkpos - 1 + cmaxData)mod cmaxData];
          end;
          Pen.Color:= CP.color;
          Pen.Width:= 5;
          polyline(arrPts);
         //works in Lz Windows.polyline(arpts,StartPos,sparkpos - startPos + 2);// <-- need local variab
        end;
      end;
      sparkPos := (SparkPos + 1) mod (cmaxChart); // subtracting the one fixed the jump back
    end;
    
    procedure TSparks.updateSparks(const MScount: integer);
    begin
      dataindex := (dataindex + 1) Mod cmaxdata;
      drawSparksE;
    end;

    Example code of Spark class which contains a reference to a controls canvas and several spark lines Classes with ring buffer, color 

    allowing better separation of code by passing the UI's canvas to this class yielding the canvas and its height and width for free!

     

    Pat   

     

     

×