Jump to content

Pat Foley

Members
  • Content Count

    367
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Pat Foley

  1. Pat Foley

    gem found in vcl.forms

    Its in 10.4.1. Would adding csTheming csScaling switches be better? csScalingDPIonly? I just want the menubar font to change.
  2. Pat Foley

    gem found in vcl.forms

    More annoying is self.FScaled :(
  3. Pat Foley

    ways to organize related code in a form?

    Boy, I hope not. WOW that is spot on diagnosis I thought it was simply a setting boundaries issue mixed with Irish Alzheimer's 'just able to remember who to hold a grudge against.' But I will work on active listening skills where both the speaker and listener learn from the conversation. Thanks. . My suggestion for you is sell the goodness of an improved codebase to the boss who tells marketing boss to offer improved product to customers who may be getting approached by unscrupled vendors. These customers may be getting an itch by a vendor to move to 'new' stuff and conversations with the customer about your company's 'new' ointment is needed. Can any work being done now use overloaded procedures being passed (enlightened) allowing existing procedures to keep being passed(deprecatedrD7) For me I should have asked are the circular references caused by a tabsheet management routine or is it needing something like shared DataModule. Only if the former should I have mentioned using Tcontrols and adding the custom Component coding horror I presented as example of reducing circular references. Also my control is an example of leaving argument names from a refactor into a control. The caveat on controls is a published property like gotoControl can't be renamed maketopwindowControl without breaking old source in old D. New D simply doesn't allow the design window to show but it will compile it. The bigger issue should a control show everything like a treeview or hide everything like a menu. In runtime tabsheets are only showing when selected. Showing all the tabs is needed only in design. In runtime only one please. The user walks thru the tabsheets with treeview using keyboard keys. CRUD and back/next buttons can be added. Launch another instance of the program with inifile data shows the state of the program a year earlier. Right clicking on task bar set instances windows side by side or stacked that should answer the first question.
  4. Pat Foley

    ways to organize related code in a form?

    I like to write code as if I am presenting to group of 5 to 10 people. Considering what each person would comment or smirk or nod with. (old guys said C tick for ; ) Here we need a navigator class that finds things and saves the view and url in that view. It would be like the finder in the Macintosh or find on your newer D10 palette. Also how many of your jobs have a F1 thru F12 spec. that each view has twelve buttons to navigate with? A. pull navigation off What is the fix to keep these buttons working when a view is removed? A. Show only controls that work. This outline uses the Vcl.Forms.screen to iterate thru all forms and uses findcomponent to get a reference for bookmarks. The screens object is windows business we are bypassing the need to know much about the forms in the application and use Tcontrol on back side for showing the object. Windows will show each tab properly when the show event is fired from Menu or button. outline of test 1. Make a browser form that has a addressbar and assign drag drops 2. At runtime create browser forms and set the parent to each tabsheet set dropdrop too! 2.1 Add a menu // for the mice less plus possible shortcut keys 2.3 add tree node // untested plus 3. At runtime populate a flow panel with bookmark objects 4. drill into tabs look at stuff. 5. drop bookmark on stuff. // enddrag here sets text, form name, controlname. 6. Stream the bookmarks to a save file these bookmarks have properties to hold the address bar text and the formname and parent 7. Next runtime the saved bookmarks are loaded into the flow panel when needed. 8. The code to iterate the screens and controls and assigns found form,parent to a reference. 8.1 The bookmark click event is assigned refformParent.show// as long as the form is not minimized this shows whatever it takes to show the control. refformParent.focus// 8.2 good time to assign drag drop stuff to buttons that should work across the whole app 9 I would have the navigator as the main form because the forms are so readily surfaced this way. oops screens is the name of the menu handler--here is example adding a goto for the enduser. this is runtime loaded from inifile Note click assigned in here as well Purpose jump to another form panel. procedure addGotos(slGoto: Tstrings); var ii,ss: integer; slDetail: Tstrings; aGoto: Tpfjumper; AformName: string; aForm,firstform: Tform; aPanel: TPanel; agotoName:string; aGotoControl: TControl; begin slDetail := TStringList.create; for ii := 1 to slGoto.Count - 1 do begin firstform := nil; aGotoControl := nil; slDetail.CommaText := slGoto[ii]; agotoname := slDetail[5]; aformName := slDetail[0]; for ss := 0 to Screen.FormCount - 1 do begin aForm := Screen.Forms[ss]; if not assigned(firstForm) and (aform.name = aformName) then begin firstForm := AForm; //since we have panels with the same name we find the appropriate panel //when the form is found aPanel := firstform.findcomponent(slDetail[1])as TPanel; end; if not assigned(aGotoControl) then agotocontrol := aForm.FindComponent(agotoName)as Tcontrol; if assigned(aGotoControl) and assigned(firstForm) then begin // saves passes the panel for the jumpstation the gotocontrol knows // its owner and parent aGoto := TpfJumper.Create(Aform); with aGoto do begin Name := slDetail[2]; Left := strtoint(slDetail[3]); Top := strtoInt(slDetail[4]); width := 80; height := 44; //Caption := Name; hint := Name; Flat := True; onclick := firstform.onClick; gotoControl := aGoToControl; parent := aPanel; break; end; end; end; end; slDetail.Free; end; Pat
  5. procedure TSparks.drawSparksE; var h, x, w, y, PtsIndex: integer; dataPos, startPos: integer; Xofs, widthDelta: double; CP: TChartPoint; //arPts: array[0..maxChart] of TPoint; // had to remove - 1 for thing to work arrPts: Array of TPoint; begin with A1Canvas do begin Brush.Color := clnavy; startPos := SparkPos; if sparkPos = 0 then begin Brush.Color := clcream; fillRect(Rect(0,0,220,220)); SparkPos := cmaxChart - copenChart; /// StartPos := 0; end; assert ((Sparkpos - StartPos + 1) > 0); setlength(arrPts,Sparkpos - StartPos + 2); h := image.Height; w := image.width; widthdelta := w/cmaxchart; Xofs := widthdelta/2; for PtsIndex := low(sparkers) to high(sparkers) do begin CP := Sparkers[Ptsindex]; y := round (h * (CP.span - CP.data^ - CP.Zero)/(CP.span - CP.Zero)); CP.lastY[dataindex] := y; for DataPos := StartPos to SparkPos + 1 do begin /// ^ polyline needs two points x := round(Xofs + dataPos * widthDelta); if way = -1 then x := w - x; arrPts[dataPos - startpos].x := round(x + Xofs * way); arrPts[dataPos - startpos].y := CP.lastY[(DataIndex + dataPos - sparkpos - 1 + cmaxData)mod cmaxData]; end; Pen.Color:= CP.color; Pen.Width:= 5; polyline(arrPts); //works in Lz Windows.polyline(arpts,StartPos,sparkpos - startPos + 2);// <-- need local variab end; end; sparkPos := (SparkPos + 1) mod (cmaxChart); // subtracting the one fixed the jump back end; procedure TSparks.updateSparks(const MScount: integer); begin dataindex := (dataindex + 1) Mod cmaxdata; drawSparksE; end; Example code of Spark class which contains a reference to a controls canvas and several spark lines Classes with ring buffer, color allowing better separation of code by passing the UI's canvas to this class yielding the canvas and its height and width for free! Pat
×