Jump to content

Pat Foley

Members
  • Content Count

    367
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Pat Foley

  1. Pat Foley

    How to force update to label during a loop

    Better to work with the controls than forcing them. Here's a code using a timer to update UI plus a way to stop the updating if needed. procedure TBaaSToDoList.Button4Click(Sender: TObject); begin Inc(FthinkerIndex); FthinkerIndex := FthinkerIndex mod 11; label1.Text := 'Thinking about ' + FthinkerIndex.tostring; //looking at which control sent message if Sender is TButton then with timer1 do Enabled := not Enabled; end; procedure TBaaSToDoList.Timer1Timer(Sender: TObject); begin Button4Click(Timer1); //or call with your thread end; private FthinkerIndex: Integer;// and in create set to zero
  2. Pat Foley

    Form closing - curiosity question..

    I am saying to use FormCloseQuery in the MainForm and not code any FormClose. Any Freeing is done in a FormDestroy. Avoiding the need for troublesome ScreenForm OnClose iteration.
  3. Pat Foley

    Form closing - curiosity question..

    The order of Screen.Forms is last used so you could use downto to avoid the active form at forms[0]. By setting the forms owner to application when creating and only coding FormCloseQuery when necessary allows no need to code the close event of each form. Pat
  4. Pat Foley

    Show the ancestors for a class?

    You would need the source code procedure TmainForm.RzButton1Click(Sender: TObject); var ClassRef: TClass; S,sS: string; begin ClassRef := Sender.ClassType; repeat sS := ClassRef.ClassName; S := S + #13#10 + sS; ClassRef := ClassREf.ClassParent; until (sS = 'TObject'); ShowMessage(S); end; to drill in. Else try this.
  5. These show my idea of controllers. Each controller is the dashboard of it's controlled domain. Better example would be a spinbutton changing a calendar view to start each week on say Sunday verses Monday. Another spinbutton changes the month the calendar view is looking at. The hours worked and leave taken each day is retrieved from DB. This Viewer was made to show a vendor that there was too much "separation of concerns" when they put vacation leave on one view and hours worked on another view. Viewer example loaded leave and hours worked on same view so adjusting for a consistent 40 hours each week when mixing benefits with hours worked was much easier. In time the vendor merged the views. Rather than actions or using TApplicationEvents. I make the DM UI aware by adding Forms and Controls to its user cause. When the application forms are created, editboxes, labels and panels are added to lists in the Event module. Note the mainform or other forms are not added to uses clause. The controls added in EM Eventmodule parent is set to panel or form passed in. but control onevent is direct consumed by the model. That makes it easier to debug IMHO. constructor TEventBoss.Create(AOwner: TComponent); begin inherited; Headings := TStringList.Create; Panels := TList<Tpanel>.create; //so controls can be added at run time Jobs := Tlist<TProc>.create; //needs empty parens to work Job() Edits := TList<TtextPair>.create; //TtextPair = Tpair<Tcomponent, Tcomponent>; Jobs.add(checkforWhiteSpace); //in the Edits list only states white space does not "change" //the value.
  6. Invert the scheme have the controllers on top and have them carry their own forms for additional display or tuning. Just set the properties the controller "looks at," drop on a form and use.
  7. Pat Foley

    "Fatal: F2048 Bad unit format" error in Delphi 10 Seattle

    Typing where dcc*.exe at the command line shows all Delphi pathed. only 10.4 and 11 pathed on my machine. I wonder why Delphi needs the system path set, wouldn't the registry be more modern pathing?
  8. Pat Foley

    Debug Points won't clear

    Use the Finder typing Debug should yield view breakpoints.
  9. Use the Rs to help. Records aRRays of Record // Reuse records by Repeat or iteRate Report the UI showing the data -additional Array[0..8*4] of TFrame //later -Input First build an app with a Stringgrid.Row[iteRater].commatext := Format('%d , %d ... [data[1],data[2]]) // convert what you have into csv format. Reduce -In Design window assign the same event to Controls calling the same procedure. Or assign event when loading UI controls at runtime. Use a Reference in that procedure - UpdateMatch(AGame: TMatch; Sender as TWinControl.Tag; Regulate the UI showing the data against time -Future matches use LeftTeam, RightTeam assigned Record with Nation string set to 'to be determined' -When the game is history the match.LeftTeam is assigned the team Use records using keys and several tables using these keys. TTeam = Record TLA, //Key Nation: string; Bracket end; TMatch = Record GMT,LocalTime: TDateTime; LeftTeam, RightTeam: TTeam; Keyed to a team or initial value end; TGamePlay = Record Game: TMatch; Keyed Team: TTeam; Keyed Yellows, Reds, Fouls: Integer; end; I would start with two hours reviewing the baseball code shared by Ray Konopka. https://delphibydesign.com/downloads/ DelphiGenerics.zip Pat
  10. Pat Foley

    Set focus on dialog box button

    Since you are working with Delphi now. There's a lot to learn about how get Delphi to speak to the Oracle or least a database. One step is learning about TDataModule. They're used in some examples. The quote has a button click inside a double click which is inside a dialog. How about enabling controls when needed. Hiding buttons are bad, better to have disabled buttons as placeholders with hints what is needed first. Pat
  11. Pat Foley

    Calculation problem

    Here's idea make a Tlist<TQuadbeam> to help separate the UI from the math. I marked up the UI to help.
  12. Pat Foley

    10.4.2 IDE crashes on start

    Sorry the tips didn't work. The 11.1 works very well on my laptop as did 10.4.1 and 10.3. Each one is always an improvement. Does the app made on Seattle machine run on the laptop that may check if the anti-virus and Access like what you are doing. The tip about loading the form in runtime is to allow not loading the suspect form dfm into design window. just have in same directory. Sometimes the IDE's browsing path gets out of sync with the compiler path.
  13. Pat Foley

    10.4.2 IDE crashes on start

    Try this in the new test project put in the code units and dfms that are not loading yet. you are already 3/8 done. This may find path error caused by code squished into small laptop. 🙂 implementation uses frmMemUnit;// put not in dpr or project var frmMemoTest: TffrmMemo; frmMainTester.btnClick(Sender: TObject); begin frmMemoTest:= TffrmMemo.create(application); // set break here or memoforms.create; frmmemoTest.Show; end;
  14. Pat Foley

    10.4.2 IDE crashes on start

    You could try this: Open new app and open a unit of the code hanging the IDE. The IDE code window draws red squiggly and warning mark where the defects are. If the units DFM is flawed that should turn up. Or top down approach is start the project with projx.dpr not projx.dproj. In case they are out of step.
  15. Pat Foley

    difference .optset and .dproj file

    A projectgroup may what what you want. Best to keep it all multi-device FMX switching the target platform in the project manager.
  16. Reading between the lines means learning actuarial science as side effect you learn how use various tools perhaps getting tools paid for as intern. The time spent porting would be better used becoming a Subject Matter Expert that way you know if the output is reasonable or just pretty.
  17. Pat Foley

    debugging crash

    I did have a crash when setting 64-bit debug to release on d11.1. And some wrecks running 10.4 in same time frame when switching over. To fix that mess I switched to 32 bit and hit compile all projects and also may have overwritten a .dproj or two by starting up with .dpr to get fresh dproj. I plan inspect the dcus freshness next time! 32==>64 is OK but 64==>32 may not have worked well on 10.4. On 11 64 debug ==> 64 release the custom components in Palette were dimmed when unable to load.
  18. Pat Foley

    Lost Code Format Menu option....

    Try using the finder(s) first type format in Title bar finder finds Options under tools then type formatter in options title bar.
  19. Pat Foley

    debugging crash

    First set a break point or hit F7 or F8 before running F9 that either key should run to cursor last position. It may be keys are remapped to Alt - F4 somehow.
  20. Pat Foley

    Windows Dayligthsaving problem

    I seen a scheme where the file is name like this to allow futureorders dir and settledorders dir sorting. Purchaseorder.vendor.20220115.xls Add NTFS partition to flash drive or new drive
  21. Pat Foley

    Loading data from dfm

    I suspect the root cause is one needs to override the virtual method with override then the inherited can be commented out or moved as needed.
  22. Pat Foley

    Tstringgrid grid index out of bounds

    Couple of things that might help with the port is That coding would yield where the cursor or record pointer is if a flat file? Renaming Field Name 'c' to align to what stored in it. Then Colcount would renamed to align to whats begin returned. I suspect its layout number. There is a columns count or fields count plus records count for each table. I think that older codebase should considered in final trim. Any improvements don't touch vintage code. If you're using 10.x program the improvements to suit that vintage. Over time d5 vintage code is not used very much. Good luck comes from months of careful planning and testing of enlightened repairs or good maintenance. Making a procedure in the DataModule that populates the VCL Control passed to it that can used any form that uses DMxx; the DMxx would only need VCL.grids added to the uses clause not needing the form calling it adding to uses clause. DM Public procedure getDataforSG(aCDS, aCDS2: TClientDataSet; rangeLeft, rangeRight, rangeTop, rangeBottom: Integer; aFieldName: string; //... aSG: TStringGRid); ... implementation procedure TDM.getDataforSG(aCDS, aCDS2: TClientDataSet; rangeLeft, rangeRight, rangeTop, rangeBottom: Integer; aFieldName: string; aSG: TStringGRid); var I,J: integer; RackID: Integer; TubIDcol: Integer;//Variant; csvfieldNames: string; fishName: string; begin aSG.Rows[0].CommaText := 'row'+ aFieldName; if rangeRight > CDS.FieldCount then rangeRight := CDS.FieldCount; if rangeBottom > CDS.RecordCount then rangeBottom:= CDS.recordCount; aSG.ColCount := rangeRight-rangeLeft; aSG.RowCount := -rangeBottom-rangeTop; //To find what c is about //pass in aFieldName := 'c'; for I := rangeTop to rangeBottom do begin aCDS.RecNo := I; fishName := ACDS.FieldByName(aFieldName).AsString; ASG.Rows[I].CommaText := aFieldName + ',' + fishName; end; //build SL header for I := rangeLeft to rangeRight do begin csvfieldNames := csvfieldNames + CDS.Fields[I].Name + ',' end; ASG.Rows[0].CommaText := ('Row,' + csvfieldNames); //Put your tubCDS code here Insert into form procedure Tmain.buildrackClick(Sender: TObject); const MagicNumberUp = 1; MagicNumberDown = -1;// would need inserted to adjust SG row offset var c, r, box : Integer; RackId : string; begin //ShowMessage('draw grid'); //setgridrow := -1; //setgridcol := -1; //box := 0; //RackId := ListBox1.Items[ListBox1.ItemIndex]; RackId := 'c'; getDataforSG(ffdata,tubdata,0 +MagicNumberUp,50000,0+MagicNumberUp,50000,RackID,StringGrid1); //(** comment rest out for now **)
  23. You missed the name of program interSector.dir It calls the chips intersector routine look at the disassembly. The only documentation I have found is this. VP2INTERSECT I done a lot of spreadsheets using just formulas over the years... Excel Range("A1:A10").Select 'Selects cells A1 to A10. Range(Range("A1"), Range("A10")).Select 'Selects cells A1 to A10. Range("A1, A10").Select 'Selects cells A1 and A10. Union(Range("A1"), Range("A10")).Select 'Selects cells A1 and A10. Range("A1:A5 A5:A10").Select 'Selects cell A5. Intersect(Range("A1:A5"), Range("A5:A10")).Select 'Selects cell A5. Delphi's DB and graphics have similar functions. TList<T> has range! Pat
  24. Pat Foley

    INI problem

    Consider MemInifile.setStrings(SL) I use it for Demos. Using it seems to reduce waking the Antimal. const Brand = 'PF'; const wrappedBrand = '\'+Brand+'\'; var IniNotFound: Boolean; var BrandNotfound: BooLean; var iniDir := Tpath.GetPublicPath; var AppHappyName := Application.Title; //following yielded /appdata/Roaming //PathedIniFile := System.SysUtils.GetHomePath + Application.Title + '.Ini'; var PathedIniFileName := iniDir + wrappedBrand + AppHappyName + '.Ini'; IniNotFound := not fileexists(PathedIniFileName); BrandNotfound := not DirectoryExists(iniDir + '\' + Brand); if BrandNotfound then ForceDirectories(iniDir + '\' + Brand); InidataFile := Tmeminifile.Create(PathedIniFileName); if IniNotFound then begin var SL: TStringList; SL := TStringList.Create; try SL.Text := cDefaultIni; IniDataFile.SetStrings(SL); IniDataFile.UpdateFile; // comment out for Demo finally SL.Free; end; end;
  25. Pat Foley

    Incompatible types bug in D11.1

    How to name Consider numerous Excel users that do not name the ranges. Naming allows the formulas to be readable and robust. In excel a name could refer to the cell that a spin control is assigned to. In Delphi the default naming scheme reflects what control or control property we are using. Knowing what slows down many XL users, one could change the arguments passed to fit the names of what is wanted or needed. procedure TfrmViewMain.MoveShapeItem(Value: TPanel; AStepDelay: Integer = 100); //Value should only used inside a TComponent in Property.setter IMHO //reflect name of thing wanted. procedure TfrmViewMain.MoveShapeItem(Panel: TPanel; AStepDelay: Integer = 100); // a good start procedure TfrmViewMain.MoveShapeItem(MovetoRight, LeftFence: TControl; AStepDelay: Integer = 100); //or may be a little much procedure TfrmViewMain.MoveShapeItem(var MovetoRight.Left, LeftFence.Left:Integer; AStepDelay: Integer = 100); //for intent use Control-J summary template to roll your poppy. //for errors look at left view mirroe in Structure
×