Jump to content

Pat Foley

Members
  • Content Count

    367
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Pat Foley

  1. Pat Foley

    Create Form

    procedure TfrmGettingStarted.Button1Click(Sender: TObject); var grid, grid2: TDBGrid; //refs to grid instances in forms` Pop2: TformPop; //for example purposes begin grid := formPop.grdProducts; //2 //allready did 1 grid.DataSource := dsProducts; //3 hookup //grid.Show; //not working in 11.1 grid.Parent.Show;//4 Pop2 := TformPop.Create(Application);//1 grid2 := Pop2.grdProducts; //2 grid2.DataSource := dsCategories;//3 //grid.Show; grid2.Parent.Show;//4 end; My thoughts are to change the Quoted to something like the above. 1. make the forms h 2. Add data grid references to DM at start up. 2.1 grid2.magically adjusts to data source some how 3. Set date grid reference data source. 4. Show using parent lets the DM to not need these forms in uses clause! It only needs to know what DBgrid is. 5. Ewe has blog articles on the nuances needed using DM with multiple edit forms~ This example just shows the data. 6. Added to an Example in Samples to verify.
  2. Pat Foley

    Warnings after Build/Compile

    white space is ignored. Change a line of code and see what happens or add a method or Property to get a full rebuild. Besides allowing the IDE to compile only the changed code only the warnings in the unit recompiled will be lit. It would nice though if the mapfile viewer would get the measles for warnings like VS.
  3. Pat Foley

    How to open a file in the already running IDE?

    Why not catch caption. Don't tell anyone I'm working up a log program 12/6/2022 6:26:47 AM= Windows.UI.Core.CoreWindow Windows Default Lock Screen 12/6/2022 6:26:54 AM= Shell_TrayWnd 12/6/2022 6:27:09 AM= TMain Main 12/6/2022 6:28:29 AM= TAppBuilder ProgramLogger - Delphi 11 - AppMain [Running] [Built] 12/6/2022 6:29:38 AM= TMain Main 12/6/2022 6:29:39 AM= TAppBuilder ProgramLogger - Delphi 11 - AppMain [Running] [Built] 12/6/2022 6:30:28 AM= Chrome_WidgetWin_1 View program flow and calls to help understand code? - General Help - Delphi-PRAXiS [en] and 3 more pages - Personal - Microsoft? Edge
  4. Pat Foley

    View program flow and calls to help understand code?

    That kind of looks like DFM source. If you start in debug layout the Stack Trace and local variables on left slide outs could looked at breakpoints set. The VCL uses component streaming to build the IDE design window these components are streamed into the compiler to make an executable. The following example would be pasted on a form. Click on Button1 and assign a click event. compile the program. Copy all the text in memo and paste onto form in IDE design. Stop the exe and recompile. Try the Hello button it will be hooked to your button1click. Note may to remove margin=4 on older D Another feature is using control key down and mousedown on TForm will drill down to TObject. object Panel1: TPanel Left = 380 Top = 70 Width = 371 Height = 341 Margins.Left = 4 Margins.Top = 4 Margins.Right = 4 Margins.Bottom = 4 Caption = 'Panel1' TabOrder = 0 object Button1: TButton Left = 140 Top = 250 Width = 94 Height = 31 Margins.Left = 4 Margins.Top = 4 Margins.Right = 4 Margins.Bottom = 4 Caption = 'Button1' TabOrder = 0 OnClick = Button1Click end object Memo1: TMemo Left = 90 Top = 20 Width = 231 Height = 111 Margins.Left = 4 Margins.Top = 4 Margins.Right = 4 Margins.Bottom = 4 Lines.Strings = ( 'object btn5000: TButton' ' Left = 140' ' Top = 250' ' Width = 94' ' Height = 31' ' Margins.Left = 4' ' Margins.Top = 4' ' Margins.Right = 4' ' Margins.Bottom = 4' ' Caption = '#39'Hello'#39 ' TabOrder = 0' ' OnClick = Button1Click' 'end') TabOrder = 1 end end
  5. Pat Foley

    form data store component ?

    1. Use meminifile.setstrings(default Strings to load program when external data not found) 2. The exe carries all the modes publish, editor, writer. The inifile and email of user loads the controls needs for that user. 3. The controls are bound when the program reads the "script". Bottom up or data driven loading. I used Expression parser by Egbert van Nes. 3 times easier than JS and CSS. Plus that pseudo business 4. The EventLeader waits for callbacks from remote API to update the UI. 5. Time Estimate TE 10 hrs. but building each form as exe and setting into app saves 1 hour per unit * 4. The eventLeader sheds its skin with a dot {.R *dfm} and classed as TwinControl was TForm. 1 hour plus 1 hr to write the script for each task's controls and interactions. Ability to adjust in the field without a recompile is worth a few hours. Scott Hanselman's blog might be a good source for info on running and setting web site.
  6. Pat Foley

    Windows VCL application pauses when window is not focused...

    Gamers and workers use various apps to keep windows up. Not sure of safety of something off the web.
  7. Pat Foley

    Windows VCL application pauses when window is not focused...

    Could you warp that big procedure with if busy exit; busy := True; ...busy := False to keep the timer updating the UI. About 6 weeks ago M$ adjusted the TThread to idle down to once per second...to save energy on blade servers. Not recalling the source of that statement.
  8. Pat Foley

    IsZero or SameValue

    Whynot? UItext := Format('%f.%f', [MN div 10, MN mod 10]); MN := round(anumber*10); when MN is Integer . _Trunc or _Floor may be available in your Script as well.
  9. I simply select the custom control cut and repaste that should keep positions and events intact when "resetting" to see a small change after "tuning". For a single control I don't mess with the library rebuild. Would that work for you. OT on your plugin would a @plugin work?
  10. Pat Foley

    StyledButton and StyledDialog

    Very good! Could the task dialog be readily parented to say a panel aligned to top of a form. A "ShowModal" call would show the panel, when panel is assigned as parent. Pat
  11. class? function TVST3Controller.GetEditorClass:TForm;? begin result:=NIL; end; function TVST3Controller.CreateForm(aParent: TForm):TForm; //pass VAR FeditorForm:TclassedForm;// .. else result:=FeditorFormClass.CreateParented(aParent);//HWND(parent)); // HWND not in FMX FMX doesn't use windows handles AFAIK. It's useful to know that FMX does not have a TWinControl. Not liking that these are not class methods. Pat
  12. Pat Foley

    Is there such a tool/functionality??

    I was able to refactor in 32 for first time in the twenties and then refactor the refactor in 64 πŸ™‚. While watching the runtime I selected the Class l.ookup and 232 warnings came up! I am running 11.1 on win 11 home.
  13. Pat Foley

    Is there such a tool/functionality??

    Shift-Ctrl-F select current unit puts clickable lines in Messages view. Would that be a solution, Pat
  14. Pat Foley

    how would you do this? Pass API params from UI into API unit

    /*----In EventModule---*/ Edits: Tlist<TtextPair>; // business logic here /*----elsewhere in UI realm--*/ EB.Edits.add(TtextPair.create(uf.Edit2,uf.lbleditErrors)); //uf ~ TForm //source Remu Lebeau response https://stackoverflow.com/questions/64145742/cannot-change-tedit-text-in-delphi. TtextPair = Tpair<TComponent, TComponent>; //edit Timer scans the cached edits length and does stuff. OT I been running some JS thanks for those posts on TMS and TypeScript.
  15. Pat Foley

    How can i have my sphere act as a canvas in viewport

    Looks like a good start πŸ™‚ Here's my stab at it. I viewed some JavaScript source and looked at the shader code in older Emba' blog article. What is your target and what video card... That is your business. Another approach is taking aircraft ground school classes about 5/8 weather plus the instructor can provide a flight to point what various clouds look like. This has Southern Oscillation Index SOI plus NOI drawn on the bitmap. Remember spherical triangle angles add to more than Euclidean triangle.
  16. Pat Foley

    Getters & Settters??

    var Sform, RForm: TfrmView; procedure TfrmMain.btnPutMemoClick(Sender: TObject); begin TfrmView.ianShowMessage(SForm, Messages.Lines, Formclick); LogForm(Sender); end; procedure TfrmMain.btnPutListClick(Sender: TObject); begin TfrmView.ianShowMessage(RForm, listbox1.Items, LogForm); end; /// showmessage only procedure TfrmMain.Button2Click(Sender: TObject); begin TfrmView.ianShowMessage(RForm, listbox1.Items, nil); end; /// singleton procedure TfrmMain.Button4Click(Sender: TObject); begin TfrmView.ianShowMessageSI(Messages.Lines,button3click) end; I noticed that prefacing var for the form argument helps out. This code also shows a "callback" being passed, Adding a FMX style list box and a que should make nice media player. class procedure TfrmView.ianShowMessage(var auxForm: TfrmView; Strs: TStrings; CallBacK: TnotifyEvent); begin if not assigned(callBack) then begin ShowMessage(Strs.text + #13#10); exit; end; if not assigned(auxForm) then begin auxForm := TfrmView.Create(Application); // auxform.cursor := crCross; auxform.Button1.onClick := CallBack; end; with auxForm do begin Memo1.Lines.SetStrings(Strs); { Enhanced ShowMessage gives console operators a 'log view' case xxx: sms Ian please open old DB for xxx: note this report only covers today xxx: note that xxxx again xxx: Showmodal; } Show; end; end; var SMlogger: TfrmView; class procedure TfrmView.ianShowMessageSI(Strs: TStrings; CallBacK: TnotifyEvent); begin ianShowMessage(SMlogger, Strs, CallBacK); end;
  17. It's in the source πŸ™‚ https://docwiki.embarcadero.com/Libraries/Sydney/en/System.StrUtils.SoundexWord Brian Longs site with low level calls http://blong.com/Conferences/DCon2002/Speech/SAPI51/SAPI51.htm#Animation Some context may be needed is Robert rubert or rowbear? Gotham or Goothem?
  18. Pat Foley

    How can i have my sphere act as a canvas in viewport

    On paper. draw a line Left to right on middle You cut your troubles in half. draw a line Top to bottom down the center you made a quadrant. draw circle holding pencil with smaller fingers put thumbnail at 0.0 and rotate paper with other hand. draw in the 45's 30's 60s. gets you one full sized circle. Rotate the paper on edge to "transform" it to side view. Notice how original circle flattens to be as thin as a shadow. You should be able to make your own procedures! Once you get the fundamentals down on paper. πŸ™‚
  19. Pat Foley

    How can i have my sphere act as a canvas in viewport

    consider Pi~22/7 Let the circumference of circle ~ 2 * 22/7 'Convert quarter turn to degree 0.25 round * 44/7 :: 0.25 round 360 degree/1 round = ' Cross out 0.25 round/1 * 360 degree/1 round = 90 degree 'Do same transformation on spin axis. 'Either use law of tangents 13th century spherical triangle work or the newer haversine 1835 to plot x,y I know only a few magic triangles (1,1,sqt(2) = gives 45) (1, sqt(3), 2 = 30,60) to give you a start. sqt(2) /2 ~ .707x .707y Draw out on paper each quadrant to determine signs.
  20. Pat Foley

    Install rotating component in RAD 10.4

    That will center it. Darby has examples like this at his DelphiforFun site. you try Ansus Johnsons Image32 for newer methods. Image of FMX
  21. Pat Foley

    Install rotating component in RAD 10.4

    Ok FMX has TControls where in VCL windows has TgraphicControls no windows handle and TWinControls. In short FMX controls don't work in VCL. To show palette on menu right click on menu and select components. To install a control into the VCL Palette be in 32 bit mode the IDE is 32 bit and needs any component to be 32 bit and to be made into a DCP so that control can used in the IDE. It's easy to stick the IDE if control is not well tested. You could load one control into the dslusr.bpl to get a feel for operation. Under component install existing and select dslusr.bpl. Save the projectgroup somewhere. Here's some code to try until you get that package loaded. procedure RotateBitmapRads(Bmp: TBitmap; Rads: Single; AdjustSize: Boolean; BkColor: TColor = clNone); var C: Single; S: Single; Tmp: TBitmap; OffsetX: Single; OffsetY: Single; Points: array[0..2] of TPoint; begin C := Cos(Rads); S := Sin(Rads); Tmp := TBitmap.Create; try Tmp.TransparentColor := Bmp.TransparentColor; Tmp.TransparentMode := Bmp.TransparentMode; Tmp.Transparent := Bmp.Transparent; Tmp.Canvas.Brush.Color := BkColor; if AdjustSize then begin Tmp.Width := Round(Bmp.Width * Abs(C) + Bmp.Height * Abs(S)); Tmp.Height := Round(Bmp.Width * Abs(S) + Bmp.Height * Abs(C)); OffsetX := (Tmp.Width - Bmp.Width * C + Bmp.Height * S) / 2; OffsetY := (Tmp.Height - Bmp.Width * S - Bmp.Height * C) / 2; end else begin Tmp.Width := Bmp.Width; Tmp.Height := Bmp.Height; OffsetX := (Bmp.Width - Bmp.Width * C + Bmp.Height * S) / 2; OffsetY := (Bmp.Height - Bmp.Width * S - Bmp.Height * C) / 2; end; Points[0].X := Round(OffsetX); Points[0].Y := Round(OffsetY); Points[1].X := Round(OffsetX + Bmp.Width * C); Points[1].Y := Round(OffsetY + Bmp.Width * S); Points[2].X := Round(OffsetX - Bmp.Height * S); Points[2].Y := Round(OffsetY + Bmp.Height * C); PlgBlt(Tmp.Canvas.Handle, Points, Bmp.Canvas.Handle, 0, 0, Bmp.Width, Bmp.Height, 0, 0, 0); Bmp.Assign(Tmp); finally Tmp.Free; end; end; procedure TForm20.Button1Click(Sender: TObject); begin RotateBitmapRads(image1.Picture.Bitmap,2/57,true, Self.Color); end;
  22. Pat Foley

    Install rotating component in RAD 10.4

    Since FMX is multi-device platform Windows specific rotation schemes are not usable. You simply use the rotation angle in the object inspector. In samples there's some animation examples that should be helpful. procedure TForm19.Button1Click(Sender: TObject); var btn : TButton; begin btn := Sender as TButton; with btn do RotationAngle := RotationAngle + 2; btn.Position.X := Width / 2 - btn.Width / 2; //workaround the rotationcenter business btn.Position.Y := Height / 2 - btn.Height / 2; end;
  23. Pat Foley

    creating circles and ovals programmatically Sin Cosin

    Important to know. as is the unit circle! But let's not use theta or alpha Greek for angle today. The first argument is x offset set it to Width div 2 Second argument is y offset set it to Height div 2 third and fourth arguments if the same draw a circle otherwise draws ellipse Canvas.Ellipse(100,100,50,75);
  24. Pat Foley

    SingleStep with F7/F8 hang IDE

    You can still use CPU view to get 'the iron' as the Late Danny Thorpe would say. This stuck my f7 and f8 Keying in CPU view stepping through Tee chart update without source. 000000000040C1E5 F3AA rep stosb :000000000040C1E5 @FillChar + $105 F9 rolls over it
Γ—