Jump to content

Pat Foley

Members
  • Content Count

    120
  • Joined

  • Last visited

Community Reputation

24 Excellent

1 Follower

Recent Profile Visitors

493 profile views
  1. Pat Foley

    Is anybody but me using monitors with different scaling?

    I am running 17" 1920*1080 main and a 23"1920*1080 sec. since the 17" T550 laptop is smaller it's at 125. (running D10.4.2) Anyway using pbrush and alt-screen I took snapshots of your ASCII chart and it was reduced in size depending on monitor taken. I snapped a form in the different monitors and it "pasted" the same even though the form appears bigger on the bigger monitor. Shank when form scaled set to true. Grew when setting pixelsperinch to 120 was 96. Edit // Just dragging a form across monitors produces an interesting effect if Scaled := True. Hard to capture with alt-PrtScr. Using PrtScr key the image shows the form across the screens not adjusted for the dots per inch of the monitors. // end edit.
  2. Pat Foley

    Re-Index a PageControl.PageIndex

    You do not need to modify the PageIndex as Uwe mentions. Since you didn't change the tabIndex at that modification, the pagecontrol is giving out of synch results. Simply remove the for loop changing the pageIndex. Its wrong.
  3. You could say the same about clYellow, clMoneyGreen. By setting a couple of adjustable colors UserColorBrush: Tcolor; UsercolorPen: Tcolor; begin ColorDialog1.Options := [cdFullOpen,cdShowHelp]; if ColorDialog1.Execute then begin MachineColor:= ColorDialog1.Color; EngineSubModel[11]:= inttostr(MachineColor); //for saving loading adding these to a list to get a count.
  4. Pat Foley

    Prevent OnClick to be handled twice

    You could have single click event and assign all custom TUButtons onClick to it. This could stored in eventForm code. Somewhat like a DataModule Only we keep message handlers in there. Also panels to use as needed by setting panel parent property to different form. The DataModule would use the eventForm code for future events Say enable submit button when channel is on line and data fields all entered.
  5. Oops. sidetracked into Application.Run
  6. Pat Foley

    How to create a grid that looks like this

    I like the Tshape in VCL It surfaces the pen and brush for setting in Object inspector properties. Here's some simple drawing techniques. implementation {$R *.dfm} uses Vcl.Imaging.pngimage; var png: TPngImage; type TStarArray = array[0..10] of TPoint; var StarPoints: TStarArray; procedure drawStar(aImage: Timage; aPoint: TPoint; Ascale: single); begin var r: FixedInt := round(1 * ascale); var r12: FixedInt := round(0.45 * ascale); var tau: double := 2 * pi; for var I := Low(StarPoints) to High(StarPoints) do begin var rf: double; If odd(I) then rf:=r12 else rf := r; StarPoints[I].X := round(apoint.x + rf * SIN(tau * I/10)); StarPoints[I].Y := round(apoint.Y + rf * -COS(tau * I/10)); end; aImage.canvas.Brush.color := clred; aImage.canvas.polyGON(StarPoints); end; procedure drawStarBM(aBM: TCanvas; aPoint: TPoint; Ascale: single); begin var r: FixedInt := round(1 * ascale); var r12: FixedInt := round(0.45 * ascale); var tau: double := 2 * pi; for var I := Low(StarPoints) to High(StarPoints) do begin var rf: double; If odd(I) then rf:=r12 else rf := r; //SineCosine() StarPoints[I].X := round(apoint.x + rf * SIN(tau * I/10)); StarPoints[I].Y := round(apoint.Y + rf * -COS(tau * I/10)); end; aBM.Brush.color := clred; aBM.polygon(StarPoints); end; procedure TForm21.Button1Click(Sender: TObject); begin with // self. // PaintBox. Image1. // finally persistent and could be passed as an argument if refactored canvas do begin var s := 'Stars'; var Ycount := Height div 40; // var Xcount := Width div 80; var r: TRect; Brush.Color := clSilver; FillRect(ClientRect); for var Y := 0 to Ycount do for var X := 0 to Xcount do begin var Xa := 0 + round(X / Xcount * width); var Ya := 0 + round(Y / Ycount * Height); if ((Xa=0) and (Ya=0)) then continue; if((Xa=0) or (Ya=0)) then Brush.Color := clSkyBlue else Brush.Color := clYellow; r.SetLocation(Xa, Ya); r.width := 145; r.Height := 80; roundrect(TRect(r), 18, 8); Textout(Xa + 6, Ya + 6, s); if not ((Xa=0) or (Ya=0)) and (random(10)>7) then DrawStar(Image1,point(Xa + 65, Ya + 15), 11); end; //Image1.Picture.SaveToFile('blobs.bmp'); (*png := TPngImage.Create; png.Assign(Image1.Picture.Bitmap); png.SaveToFile('blobx.png'); *) // publish as html png later done end; end; // extended Tshape paint { TSuperShape } procedure TSuperShape.Paint; var w, h: integer; textSize: TSize; begin inherited; Brush.Color := clBtnFace; with Canvas do begin drawStarBM(Canvas,point(50,50),25); font.Size := -15; textSize := TextExtent(Moniker); w := (Width - textSize.cx) div 2; h := (Height - textSize.cy) div 2; TextOut(w,h,Moniker); end; end;
  7. Pat Foley

    DBGrid DrawColumnCell

    btnChangeS := TButton.Create(grid1);
  8. Not that's important or relevant , found this https://stackoverflow.com/questions/7090053/read-all-ini-file-values-with-getprivateprofilestringthis . Would be able to go back to D1 🙂 Wouldn't the subclass work since would still descend from TcustomIniFile?
  9. How about Type TdzIniFile = Class(TmemIniFile) {$if ver < 12} // procedure dealwithsubsections {$endif} TdzRegFile = Class(TRegIniFile) procedure dealwithsubsections Having two components would match better with their mem or reg business. Unsure if switch is usable or needed.
  10. Upgraded to D14.4.2 For EU End User input errors should provide helpful feedback. 'not enough data entry', 'too much data' masked tedits help Exceptions need to be surfaced!
  11. Pat Foley

    Edit code section in post

    Hey, codebox </> selector just reappeared. Copying text from browser to IDE and back again to browser window did sometime to the browser edit window the day before 😞 So another question how to cancel a post before saving? Thanks
  12. Pat Foley

    TPopupMenu with group headers

    More info. procedure TpfEngine.AddScreenMenuitems; var tabpageCount: integer; // used in menuclick handler and tag business ScreenMenu: TMenuitem; begin menucount := 0; extendedTScount := 0; For tabPageCount:= 0 to ComponentCount - 1 do if Components[tabpageCount].ClassNameIs('TTabSheet')then if (Components[tabpageCount] as TTabSheet).TabVisible then begin inc(MenuCount); ScreenMenu:= TMenuItem.Create(self); ScreenMenu.caption:= (Components[tabPageCount]as TTabSheet).Caption; ScreenMenu.Tag:= tabPageCount; extendedTScount := ScreenMenu.Tag; ScreenMenu.onClick:= MenuScreenClick; // dirty patch if ScreenMenu.caption = 'Prime Mover' then begin ScreenMenu.Enabled := False; ScreenMenu.Bitmap.LoadFromResourceName(HInstance,'BITMAP_ST');//:= Image1.Picture.Bitmap; end; .... Screens.add(screenmenu) // Screens:TMenuItem end;
  13. Pat Foley

    TPopupMenu with group headers

    Menu.Break := mbBarbreak //mbbreak example ScreenMenu.Break := mbBarBreak; ScreenMenu.Enabled := False; // ScreenMenu.Bitmap:= Image1.Picture.Bitmap; ScreenMenu.Bitmap.LoadFromResourceName(HInstance,'BITMAP_3');
×