

Pat Foley
-
Content Count
428 -
Joined
-
Last visited
-
Days Won
2
Posts posted by Pat Foley
-
-
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
-
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.
-
Couple of things that might help with the port is
QuoteColCount := 1{FixedCols} + ddata.RackClientDataSet.FieldByName('c').AsInteger; RowCount := 1{FixedRows} + ddata.RackClientDataSet.FieldByName('r').AsInteger;
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 **)
-
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
-
INI problem
in VCL
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;
-
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
-
Look at Line 63
-
My frontal lobe Latency is one-two minutes L1 cache. one to two weeks L2 cache every else is water under the bridge. excepting a few grudges. 🙂
-
1
-
-
I learned alot from Mike questions and answers. Here's my stab at it.
program interSector; {$APPTYPE CONSOLE} {$R *.res} {$o+} uses System.SysUtils, System.Diagnostics, Classes; type // TsetOPs = (EditStr, ButtonStr, CheckStr, FormStr, FrameStr, ListBoxStr, PageControlStr, TabControlStr, RadioBtnStr, ComboBoxStr); TdbKey = (dateID, sqlID, CashID, EditID, ButtonID, CheckID, FormID, FrameID, ListBoxID, PageControlID, TabControlID, RadioBtnID, ComboBoxID); // : integer; TsetKeys = set of TdbKey; const cLoop = 100000000; cSet: TsetKeys = [dateID, CheckID, FrameID, ComboBoxID]; var vSW: TStopwatch; vBool: boolean; procedure IsIntersected(const aID: integer; var aB: boolean); inline var Intersected: TsetKeys; Op: TdbKey; begin Intersected := [CheckID, FrameID, ButtonID] * cSet; aB := aB or (Intersected <> []); //for OPs in Intersected do to build relational DB end; begin vBool := false; vSW := TStopwatch.StartNew; var I: CppULongInt := 0; while I < cLoop do begin Inc(I); IsIntersected(I, vBool); end; Writeln(Format('IsIntersect = %5s', [vSW.ElapsedMilliseconds.ToString])); vBool := not vBool; readln; end.
interSector.dpr.44: IsInterSected(I,VBool); 000000000052B51F 89C1 mov ecx,eax 000000000052B521 85C9 test ecx,ecx 000000000052B523 7D05 jnl interSector + $6A 000000000052B525 E8A611EEFF call @BoundErr 000000000052B52A 480FB70D1E010000 movzx rcx,word ptr [rel $0000011e] 000000000052B532 66230D035B0200 and cx,[rel $00025b03] 000000000052B539 803D5831030000 cmp byte ptr [rel $00033158],$00 000000000052B540 750D jnz interSector + $8F 000000000052B542 663B0D09010000 cmp cx,[rel $00000109] 000000000052B549 7504 jnz interSector + $8F 000000000052B54B 33C9 xor ecx,ecx 000000000052B54D EB02 jmp interSector + $91 000000000052B54F B101 mov cl,$01 000000000052B551 880D41310300 mov [rel $00033141],cl interSector.dpr.41: while I < cLoop do 000000000052B557 81F800E1F505 cmp eax,$05f5e100 000000000052B55D 72B6 jb interSector + $55 000000000052B55F 90 nop
-
3
-
-
Use ActionManager as in design window and its property editors and sub editors adding stubs to be used like this to connect the events at runtime.
procedure TForm1.Button2Click(Sender: TObject); const popupmenuitemCaptions: array[0..1] of String=('Action4','frameAction1'); var popupFrameCaption: string; I: Integer; A: TContainedAction; begin for popupFrameCaption in popupmenuitemCaptions do for I := 0 to ActionManager1.ActionCount - 1 do begin A := ActionManager1.Actions[I]; if A.caption = popupFrameCaption then begin A.OnExecute := Frame11.PopupActionBar1.Items[0].OnClick; A.Execute; Break; end; end; end;
object ActionManager1: TActionManager ActionBars = < item Items.CaptionOptions = coAll Items = <> ActionBar = ActionToolBar3 end> LinkedActionLists = < item Caption = '(No Name)' end> Images = ImageList1 Left = 722 Top = 172 StyleName = 'Platform Default' object Action4: TAction Category = 'Frame' Caption = 'Action4' ImageIndex = 1 OnExecute = Action4Execute end object DatasetFirst1: TDataSetFirst Category = 'Dataset' Caption = '&First' Hint = 'First' ImageIndex = 0 end end
Inspecting the object in design by copying it to notepad shows Images property to possibly set at runtime.
-
On 3/12/2022 at 2:08 AM, PaulD said:Basically, a user interface designed to launch a handful of applications such as a media player, map software, etc. It would use large buttons designed to be easy to use on a dash mounted touch-screen similar to a commercial car stereo.
It would be easier to duct tape an iPad over the airbag and run the speakers thru blue tooth.
Second way. third item.
https://www.makeuseof.com/tag/projects-raspberry-pi-touchscreen-display/
Third way. Delphi has a location demo for phone that works and ties into google maps.
covers the map software. 25% of project would done. Works on my present android phone.
Four.
Finding screen size.
to get the feel of embedded system Use the Task Manager to shut down Win Explorer. You can restart from Task Manager using new task Explorer.
-
1
-
-
2 hours ago, Tom Chamberlain said:Maybe something to do with Marco's blog post from January 3rd, here.
Actually Marco's post is between D11 to D10.4 PE flags updated to 6 to allow thinner borders and more margin.
21 hours ago, perryhs said:window autosized perfectly to the size
Try Autosizing False and Center True. To center image on form set align = alClient. That allows changing images readily.
-
If you stored the image in the image control. Try this in 10.4
- Select Image in Design window.
- Bring up the Picture editor F11 for object inspector and click on ellipses ...
- In the Picture editor save image as some thing else plus extension what it was.( .bmp .ping)
- view the image with other app.
- Other wise just delete the image control and install fresh one.
-
Sorry lost color when I tried different names in the code in Notepad++.
-
Just as well run a Nick Hodges Nu 7 on it Control-d "to save time formatting" if you spent the money for chain saw.
procedure TForm1.serverExecute(AContext: TIdContext); var clients: tlist; i: integer; messaggioprelevato, FileName: string; FileStreamIn: TFileStream; begin messaggioprelevato := AContext.Connection.IOHandler.ReadLn; // send this magic string just before you send file stream if messaggioprelevato <> '!FILE#' then begin clients := Server.Contexts.LockList; try for i := 0 to connessi - 1 do TIdContext(clients.Items[i]).Connection.IOHandler.WriteLn (messaggioprelevato); finally Server.Contexts.UnlockList; end; end else begin // recv file stream TThread.Synchronize(nil, procedure begin showmessage('Arriva qualcosa...'); FileName := 'C:' //suspect drive name in Windows end); FileStreamIn := TFileStream.Create(FileName, fmCreate); try AContext.Connection.IOHandler.ReadStream(aFileStreamIn); finally FileStreamIn.Free; end; end; end;
-
What do the Objects look like IDE?
Design copy from 10.4
// after fix
object DateTimePicker1: TDateTimePicker
Left = 280
Top = 32
Width = 186
Height = 21
Hint =
'Use<> arrow keys to select time field Up/Down arrow Keys to sele' +
'ct new field value'
Date = 44628.000000000000000000
Format = 'dd/MMM/yyyy hh:mm:ss'
Time = 0.690069409720308600
DateFormat = dfLong
ParentShowHint = False
ShowHint = True
TabOrder = 5
end//Fresh
object DateTimePicker2: TDateTimePicker
Left = 64
Top = 32
Width = 186
Height = 21
Date = 44629.000000000000000000
Time = 0.024456481478409840
TabOrder = 6
end -
QuoteGive me six hours to chop down a tree and I will spend the first four sharpening the axe. Abe Lincoln
That means to a painter read the directions on can One gallon to 100 square feet. To a pilot ground school. To a programmer a little knowledge is a dangerous thing--drink deep or drink not*. I try make a game of it, reading a chapter out of a book, write some code in notepad, and if runs without error I win big and even a few errors is a win when the coding structure is remembered readily. That how I sharpened my axe in the olden days now I use notepad++ 🙂
*A quote quoted in Pascal with Excellence.
-
Task Manager mentioned in Cary Jensen's question on SO about fd copydatasset memory issue.
-
59 minutes ago, MrCamarium said:procedure TForm1.serverExecute(AThread: TIdContext);
Replace with magic overloaded procedure the compiler knows which to use with args passed.
procedure serverExecute(AThread: TIdContext; const aFileName); overload; ... procedure TForm1.serverExecute(AThread: TIdContext; const aFileName);
Add second overloaded procedure.
59 minutes ago, MrCamarium said:/// in interface procedure ServerExecute(AContext: TIdContext; const AMessage: string); overload; ... Implementation procedure TForm1.ServerExecute(AContext: TIdContext; const AMessage: string);
Never Merge when better to unravel!
-
You are saying local variable names are prefixed with 'a' when your function is used? That lets the person reading the code know what variables are to be touched outside the procedure. That's better than marking the variables that are not touched outside a procedure with an L.
I think the Help insight control J s for summary is good. It has better latency than the
Control Space business.
-
Wouldn't a custom template do? Hitting CreateC shown with Control-J yields
constructor Create(AOwner: TComponent); override;
-
Just put the image you are using for the desktop into your program.
double click on the form in the IDE to bring up FormCreate.
set backgroundImage named imgAnimals with pix used for desktop image.
You can use Panels for rendering your Boxes that have labels allready centered!
imgAnimals := Timage.Create(Self) parent := Self; imgAnimals.align := alClient; imgAnimals.Picture.LoadFromFile(cAnimalPixPathed); (**above put this stuff. const cAnimalPixPathed = 'path and filename'; var imganimals: TImage; //Put upstairs BoxLabels := TList<TPanel> **); {You move the panels in BoxLabels around with mouse then use show and hide as necessary.}
-
How about low code drap n drop using Delphi IDE and VCL.
Drop timage on the form
Set the following form properties under F11 Key
Color = clMoneyGreen
TransparentColor = True
TransparentColorValue = clMoneyGreen
procedure TForm10.Timer1Timer(Sender: TObject); begin Image1.left := ScreenToClient(Mouse.CursorPos).X - Image1.width div 2; Image1.Top := ScreenToClient(Mouse.CursorPos).Y - Image1.Height div 2; end;
-
debugging crash
in General Help
Posted
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.