

Pat Foley
Members-
Content Count
439 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Pat Foley
-
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 -
Retrieving outlook contact emails
Pat Foley replied to Connie McBride's topic in Algorithms, Data Structures and Class Design
I used the code for reverse phone lookup that's for an xxx with xx,xxx outlook accounts. You need to make a custom list of clients, a Client group email and ... then as employees come and go you add remove their access to the companies Client email account. Or you could enhance your application by logging when clients are added, contacted, removed from client list. I sent out emails and SMS each week to departments as client schedules were updated. -
Retrieving outlook contact emails
Pat Foley replied to Connie McBride's topic in Algorithms, Data Structures and Class Design
Again I would use OutLook to make the output using export. example mapping https://jkp-ads.com/rdb/win/s1/outlook/mail.htm Also here is some old (2017) Excel code from Ron's earlier site Sub DemoAE() Dim colAL As Outlook.AddressLists Dim oAL As Outlook.AddressList Dim colAE As Outlook.AddressEntries Dim oAE As Outlook.AddressEntry Dim oExUser As Outlook.ExchangeUser Set colAL = Outlook.session.AddressLists '("Offline Global Address List") For Each oAL In colAL 'Address list is an Exchange Global Address List If oAL.AddressListType = olExchangeGlobalAddressList Then Set colAE = oAL.AddressEntries For Each oAE In colAE If oAE.AddressEntryUserType = _ olExchangeUserAddressEntry _ Or oAE.AddressEntryUserType = _ olExchangeRemoteUserAddressEntry Then Set oExUser = oAE.GetExchangeUser ' Debug.Print (oExUser.JobTitle) ' Debug.Print (oExUser.OfficeLocation) ' Debug.Print (oExUser.BusinessTelephoneNumber) ' Range("A1").Offset(X, 1) = oExUser.JobTitle Range("A1").Offset(X, 9) = oExUser.ID 'OfficeLocation Range("A1").Offset(X, 8) = oExUser.MobileTelephoneNumber 'HomeTelephoneNumber Range("A1").Offset(X, 7) = oExUser.Name 'Range("A1").Offset(X, 5) = oExUser.PrimarySmtpAddress X = X + 1 End If Next End If Next End Sub -
Even holding the mouse over the symbol should show its unit and line! // since I loaded it look how TStrings Visualizer vs the IDE code screen in rendering in 12.2
-
Retrieving outlook contact emails
Pat Foley replied to Connie McBride's topic in Algorithms, Data Structures and Class Design
One way is save as .pst file or .csv file inside of Outlook. Second way is use VBA to learn the names of methods that Outlook uses to save lists in different formats. -
I think the issue lies in the coding, each series properties needed be updated consistently. This example shows renaming the series and the labels to allow a consistent means of updating the control. Consistently meaning each control deals only with the data it was named and Created for. procedure TForm1.Button1Click(Sender: TObject); const labelAft = 'Afternoon'; labelNite = 'Nite'; labelDay = 'Day'; ShiftDayFraction = 8/24; clNite = clRed; var seDay, seAfternoon, seNight: TGanttSeries; begin seDay := Series1; seAfternoon := Series2; seNight := Series3; seNight.Clear; seDay.Clear; seAfternoon.Clear; var addC: Boolean := CheckBoxBreakLabels.Checked; var startDate: TDateTIme := Now; startDate.SetTime(4, 0, 0, 0); seDay.AddGanttColor(startDate + ShiftDayFraction, startDate + 2 * ShiftDayFraction, 1, labelDay, clGreen); if addC then seAfternoon.AddGanttColor(startDate + 2 * ShiftDayFraction , startDate + 3 * ShiftDayFraction, 3, labelAft, clBlue); seNight.AddGanttColor(startDate, StartDate + ShiftDayFraction, 2, labelNite, clNite); // seNight.AddGanttColor(startDate, StartDate + ShiftDayFraction, 1, 'Sametimeline', clNite); end;
-
GroupDescendentsWith - Why 'TCustomAction' is promoted to TControl?
Pat Foley replied to GabrielMoraru's topic in VCL
So that it is found in the controls list of the control or component vs the components list of a form or application. -
Problem with selection markes in Delphi IDE for Controls with SubControls
Pat Foley replied to Tom Mueller's topic in Delphi IDE and APIs
Somewhere I have a control that draws a focus rect and tests rect intersect of all controls in componentlist to add to selected list. Just as lost is a control that draws a connector between selected controls using clienttoscreen. I will look for the controls later. I'll attach the mention control. Depending how you assign the mouse events either drop on the form or resize it manually the TCustomPanel does not have the align prop. Unsure why I was drawing the focus rect with DC back then. I use a Tshape brush style set to bsClear and pen dotted line now. -
Problem with selection markes in Delphi IDE for Controls with SubControls
Pat Foley replied to Tom Mueller's topic in Delphi IDE and APIs
To reveal the markers add to source or set in Object Inspector BorderWidth = 5 -
Problem with selection markes in Delphi IDE for Controls with SubControls
Pat Foley replied to Tom Mueller's topic in Delphi IDE and APIs
I should have included this procedure TTestSelectMarker.WMSIZE(var message: TWMSIZE); begin // FPanel.setbounds(10,10,Width- 2 * 10, Height - 2 * 10); Fpanel.Align := alClient; end; -
Problem with selection markes in Delphi IDE for Controls with SubControls
Pat Foley replied to Tom Mueller's topic in Delphi IDE and APIs
You need to add the paint event to draw the control in the IDE plus WMSIZE to allow sizing of controls being drawn. Changing to descend from Tpanel allows working control base to add control to. Later the control can be switched to TCustomControl or TWinControl. unit uTestSelectMarker; interface uses Classes, Vcl.Controls, Vcl.ExtCtrls, Winapi.Messages; type TTestSelectMarker = class(TPanel) //change to TcustomControl or TWinControl private FPanel: TPanel; protected procedure Paint; override; procedure WMSIZE(var message:TWMSIZE); message WM_SIZE; public constructor Create(AOwner: TComponent); override; end; procedure Register; implementation uses Graphics; constructor TTestSelectMarker.Create(AOwner: TComponent); begin inherited;// Create(AOwner); Color := clBtnFace; FPanel:= TPanel.Create(self); // FPanel.SetSubComponent(True); // Uwe mentioned this in SO post FPanel.Parent:= self; FPanel.BevelOuter:= bvNone; FPanel.Color:= clCream; FPanel.Visible := True; end; procedure Register; begin RegisterComponents('Test', [TTestSelectMarker]); end; procedure TTestSelectMarker.Paint; begin inherited; FPanel.Caption := Name; end; procedure TTestSelectMarker.WMSIZE(var message: TWMSIZE); begin FPanel.setbounds(10,10,Width- 2 * 10, Height - 2 * 10); end; end.