

Pat Foley
Members-
Content Count
439 -
Joined
-
Last visited
-
Days Won
2
Pat Foley last won the day on August 9 2023
Pat Foley had the most liked content!
Community Reputation
54 ExcellentTechnical Information
-
Delphi-Version
Delphi 12 Athens
Recent Profile Visitors
-
Delphi IDE Moving components undo or similar?
Pat Foley replied to bresson's topic in Delphi IDE and APIs
This is one place using the IDE Insight helps greatly. In the design window. use <F6> if your fingers are on the top row of the keyboard. or simply the <Ctrl .> if closer to bottom row. type in Control name or Class type of control. Select with Enter Key. Press <F11> then the Object inspector finder is focused and type in property to edit. Or simply tab thru the controls, moving/sizing them with control keys Shift or Ctrl with the arrow keys. Avoiding this practice in your case by simply pressing <F11> key instead. (Also verifies the tab order) Or the Structure panel is either mouse able or arrow keys to avoid touching the controls with mouse in the design window. Or View revisions by selecting Alt-F12 and select History there. 🙂 -
Global in RTL for unit communication?
Pat Foley replied to david berneda's topic in RTL and Delphi Object Pascal
Use class names vs class types to avoid adding B in uses clauses. Existing controls and forms are renamed to fit existing inifile naming scheme. And as the controls loaded, if their parent is not found, they make one--example a Serie or line needs a Chart if not found we make a chart parenting it to the named form or control. So all Tee.* is only in mainform BOSS uses. letting the Boss code update the charts and legends parented elsewhere. Use ComponentClass and add "fixup" and parenting later for UI controls and List<TMyControl>for non-visual controls. A startup inifile is embedded in file to allow the program to run in "Demo" when inifile not found. Mainly to build menu and tree Navigation. But more importantly reduce the need for global variables by using 'names'. Then with empty uses clauses we stick in a DM needed to share Imagelist. and a Boss unit that reads in the controls needed. -
To fix your example set the tabstop to False on the Edit controls. Better to set the Key = 0 when Key = VK_RETURN is handled to let the focus move to next control (Excel style moves to next cell on enter). More important is have the tabs z-order end at a submit button that confirms the entries. Sample's editkeydown handles the Edits and a Listbox to let the user select the right item the first time rather a screen that covers not only the app but other running apps to fix typos. Also the InputBox allows an edit of its items. procedure TForm1.EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); var ii : Integer; s :string; begin var MoreZ := not (ssShift in Shift); if (Key = VK_RETURN) and (Sender is TEdit) then begin Key := VK_Tab; var Edit := Sender as TEdit; if not MoreZ then Edit.text := InputBox('Fixer', '?', Edit.text); SelectNext(Edit,MoreZ,True); end; if (Key = VK_RETURN) and (Sender is TListBox) then begin Key := VK_TAB; var LB := TListBox(Sender); SelectNext(LB,MoreZ,True); ii := LB.ItemIndex; if ii > -1 then s := LB.Items[ii] else begin s := 'Select something in' + LB.Name; MoreZ := True; end; if MoreZ and (ii > -1) then LB.Items[ii] := InputBox('lister', '?', s); end; end;
-
Did you use Turbo pascal Programmers Library by Jamsa back then and and how about Ready-to_Run Delphi 3 Algorithms both mention using generic coding for code reuse back then should help in learning code reuse and simply reusing someone else code now. Tstringlist.Commatext may be able to lift your old code and Format('%s,%,s', ['name', Number.tostring])to feed Stringgrid.Rows[0].commaText := 'name,Number';
-
mmm, I run win 11 are you still using DOS. procedure TForm16.Button4Click(Sender: TObject); var SL: TStrings; // F1 click bait begin SL := memo1.Lines; for var aDate in [0, 1,2,3, 30000-2*365-32-17 , 30000, 40000, 50000, 100000] do begin SL.Add(DateToStr(aDate)); end; end;
-
Memo lines{i] to labelv ok. Labels to Memo lines nope
Pat Foley replied to Freeeee's topic in General Help
By switching to Static text like a label but the advantage of windows handle so it be selected then you add a event to the win control like so. F2 is an Edit control. I'm sure Marco Cantu has much examples in his books. procedure TForm16.Clicker(Sender: Tobject); begin EZ := F2.Text; (Sender as TStaticText).Caption := EZ; end; procedure TForm16.RzButton1Click(Sender: TObject); var Labels: Array[0..9] of TStaticText; var stlabela: TStaticText; begin var count:= 0; for var stlabel in Labels do begin Labels[Count] := TStaticText.Create(Self); stlabela := Labels[Count]; stlabela.Parent := self; stlabela.SetBounds(24,20*count,50,23); stlabela.onClick := Clicker; stlabela.Caption := count.ToString; stlabela.Show; Inc(count); end; end; -
I actually looked at some JS code and Physics for Game Developers by Bourg for stuff on Quaternions. The Model-3D sample may be a start. Years ago at a talk about making the Matrix movie the speaker said the stuff in background was all 2D "decals". And it takes three years of schooling for 3D. (Also even a graphic artist needs know linux to get hired.) procedure TModel3DTest.Form3DMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single); begin if (ssLeft in Shift) and Mouse then begin DummyX.RotationAngle.X := DummyX.RotationAngle.X - (Y - Down.Y)* 0.3 ; DummyY.RotationAngle.Y := DummyY.RotationAngle.Y + (X - Down.X)* 0.3 ; Down.X := X; Down.Y := Y; end; end;
-
What making One Application for now. And Run it Three times at a time. set the Parameters Data1.dat , Data2.dat, Data3 for first app. set the Parameters Data2.dat , Data3.dat, Data1 for Second app. set the Parameters Data3.dat, Data1.dat, Data2 for Third app. ... procedure FindDeltas( const Param{1}, Param(2), Param(3)); begin Old code in here end; Is it a lazy steer that its 'looking' at?
-
What version I using 12.2 and tried this IDE insight and it works well with the keyboard. start Delphi Press <F6> and enter VCL Using down arrows select Windows Application Press<F6> enter VCL select VCL form Press<F6> Enter TButton Repeat above as needed. Press<F6> Enter Help
-
Looking for CBuilder/VS help on C open source project
Pat Foley replied to Vincent Parrett's topic in Job Opportunities / Coder for Hire
You are right. The files to look at is web.pas has var dom, console, and window. The js.pas uses JSValue and parses JSON objects unsure if the eval can do multiline. -
Looking for CBuilder/VS help on C open source project
Pat Foley replied to Vincent Parrett's topic in Job Opportunities / Coder for Hire
What about Lazarus pas2js This screen capture Shows the source in the js.pas. Its hid in the co..\pas2js\Demos -
Share a data between two units in dynamic loaded BPL.
Pat Foley replied to CRO_Tomislav's topic in VCL
Would not using global variables for any forms and using unique name for forms to use make it a better idea. To reduce complexity a TreeView is loaded in mainform with nodes referencing the forms being created. The Treeview can then be parented to the Active form to let the user navigate the app readily. A DM can help surfacing the data through the UI. -
Share a data between two units in dynamic loaded BPL.
Pat Foley replied to CRO_Tomislav's topic in VCL
You might to study and use this to move cursor to control being selected. I want to add it to IDE <F6> or <Ctrl>. function it only jumps to selection without any animation 🙂 procedure TTaskmaster.moveMouse(AtaskDetail: TInstruction); var x, y, MouseXError, MouseYError: integer; ControlCenter: Tpoint; AC: TControl; begin findControl(AtaskDetail, AC); if not assigned(AC) then exit; if assigned(AC.Parent) then AC.Parent.Show; AC.Show; x := AC.ClientOrigin.X + AC.width div 2; y := AC.ClientOrigin.y + AC.height div 2; begin MouseXError := round(1.12 *(x - mouse.CursorPos.X)); MouseYError := round(1.12 * (y - mouse.cursorPos.y)); // MouseXError := min(MouseXError, 10 * sign(MouseXError)); // MouseYError := min(MouseYError, 10 * sign(MouseYError)); controlCenter.X := mouse.CursorPos.x + MouseXError; controlCenter.Y := Mouse.CursorPos.y + mouseYError; mouse.CursorPos := ControlCenter; end; repeatTask := (abs(MouseXError) > 7) or (abs(MouseYError) > 7); end; -
Share a data between two units in dynamic loaded BPL.
Pat Foley replied to CRO_Tomislav's topic in VCL
This should yield control asked for. procedure TTaskMaster.findControl(AtaskDetail: TInstruction; var AC: TControl); var ff, ii : integer; sForm, sControl: string; begin with AtaskDetail do begin if Control <> nil then AC := Control else begin sForm := controlForm + ' not found.'; sControl := controlName + ' not found.'; //screens move about on windows list top window usually 0 :( for ff := 0 to Screen.FormCount - 1 do if Screen.Forms[ff].name = controlform then begin sform := controlForm; with Screen.Forms[ff] do begin for ii := 0 to componentcount - 1 do if Components[ii].Name = ControlName then begin sControl := controlName + ' comps ' + ii.ToString; Control := Components[ii] as Tcontrol; //onBS(False, format('Item %d Found %s',[ii,controlName])); break; end //else//if name //run := false; // onBS(False, format('Item %d not found %s',[ii, controlName])); end;// with screen forms end; //if screen.forms onBS(False, sForm + ' ' + sControl); end;// else end;//with taskdetail end; What TInstruction is TInstruction = class //position in Db Atom: PAtom; Control: TControl; ControlForm: string; //3 ControlName: string; //2 Description: string;//6 //Nu: integer; //0 Kind: string; //1 was integer KindNU: integer; referenceValue: Double;//5 tagName: string; //4 tagValue: Double; //no data in table end; -
Share a data between two units in dynamic loaded BPL.
Pat Foley replied to CRO_Tomislav's topic in VCL
One thing about XML is on a treeview each node needs a unique caption so as tabSheets or the parent of control wanted are added a number is added to the node's caption as the forms are added. Second thing is the Control could have data reference added. type // On the UI controls side carry some data references for convenience // the data side could use Dependance Injection to tie in UI controls TDataButton = class(TButton) Form: TControl; Strs: TStrings; end; What's neat about MDI you can create a new childform inside a begin..end. To access the form elsewhere use Application.Screen