Jump to content

Pat Foley

Members
  • Content Count

    411
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Pat Foley

  1. Pat Foley

    Popup window with focus inside.

    runtime forms should feed mouseovers and form name back to creator form. Perhaps what you want is a windows balloon tip.
  2. Pat Foley

    Popup window with focus inside.

    unit mainFocused; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure FormClick(Sender: TObject); procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } destructor Destroy; end; var Form1: TForm1; implementation uses unFocused; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin UF.IniZ(self); end; procedure TForm1.Button2Click(Sender: TObject); var I,C: integer; F: TForm; begin with Screen do begin for I := formCount - 1 downto 0 do begin F := Forms[I]; for C := 0 to F.ComponentCount - 1 do if F.Components[C] is TButton then begin F.Show; (F.Components[C] as TButton).parent.show; (F.Components[C] as TButton).Show; caption := F.Name; application.ProcessMessages; sleep(1200); Break; end; end; end; end; destructor TForm1.Destroy; var I: integer; begin onclick := nil; with Screen do begin for I := formCount - 1 downto 0 do begin Forms[I].close; end; end; end; procedure TForm1.FormClick(Sender: TObject); begin Caption := 'clicked by ' + (Sender as TForm).Name; Self.Show; Button1.SetFocus; end; procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin Caption := 'Mouse over ' + (Sender as Tcontrol).Name; end; end. unit unfocused; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls; type TfrmdrawFocused = class(TForm) Button1: TButton; Image2: TImage; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } toFocusAhead: TForm; procedure ForwardFocus(Sender: TObject); procedure IniZ(anOwnerForm: TForm); Destructor Destroy; end; var UF, frmdrawFocused: TfrmdrawFocused; implementation {$R *.dfm} { TfrmUnfocused } procedure TfrmdrawFocused.Button1Click(Sender: TObject); begin beep; end; destructor TfrmdrawFocused.Destroy; begin tofocusAhead.free; inherited; end; procedure TfrmdrawFocused.ForwardFocus(Sender: TObject); begin //inherited; //squash local click toFocusAhead.OnClick(self); end; procedure TfrmdrawFocused.IniZ(anOwnerForm: TForm); begin Application.CreateForm(TfrmdrawFocused, UF); with UF do begin name := 'UF' + Screen.FormCount.ToString; Caption := name; setbounds(10,20,260,170); toFocusAhead := anOwnerForm; onclick := ForwardFocus; onmousedown := nil; onmouseMove := anOwnerform.OnMouseMove; Color := $1E69D2; show; end; end; end. Try these forms with aux forms Borderstyle set to bsnormal then no border.
  3. Pat Foley

    Popup window with focus inside.

    The combo box drop down can only be opened in active window.
  4. Pat Foley

    Popup window with focus inside.

    If there is flickering going on I would guess a onchange event is looping. radio buttons calling each other after being changed by the other. The user needs to know only one window is in focus at a time. To help the user we would still draw halo around the control using the popup, color the popup the same as launching form. Or showing form with image.picture.bitmap of a active form saved as bitmap would work when shown as toolbar. But not recommended.
  5. Pat Foley

    Make a complete DataSet event conditional??

    Use the back of past year's calendar to draw out the redesign. Happy New Years.
  6. Pat Foley

    If Then dilema

    Actually in VB I made video poker game. The enumerations allow say washing machine to be emulated when combined with a case statement. Each enum needs to be in order in the case statement. As you add more features you just insert additional enum. Also consider the scPlaying Its' ordinal value is zero so its first in case statement. More importantly it helps laying out the program. Until you get around to making the play routine routine it just passes through waiting for change in game status. I'll fab up a working example in week in week or two. A key or button click would change status then call procedure with case statement. Pascal with Excellence quotes Alexander Pope--A little learning is a dangerous thing, drink deep, or taste not. // I try to share knowledge so people need not read the documentation or hit a barn when learning to fly.
  7. Pat Foley

    If Then dilema

    No need for that. Its your program and by doing it yourself will allow you to get higher up the hill. promote isplaying, isgameover,isplayer2turn booleans to enumeration of Tsolcon = (scPlaying, scGameover, scNewGameQ, scDeal) gamestatus:Tsolcon; global set gamestatus := scNewGameQ In a timer event place a case statement Case gameStatus of ... scNewGameQ: begin gamestatus := scDeal; // next timer event the code in scDeal will be called end; scDeal: //calls procedure dealCards end; Other events Buttonclick simply change gamestatus the timer's event acts on the status change
  8. Pat Foley

    Can an app beat a spreadsheet?

    I used XL on Mac starting with 2 through XL 4. XL 4 added forms--by printing out the macro sheet and taping the sheets One had the big picture with all the forms and code together Not sure what goes on Apple side now. Example does not to be on macro sheet. cellname a b c 'name 'variable 'comment 'xvalue 1 'after being renamed "b2" shows as xvalue 'yvalue 1 'zvalue =xvalue+yvalue ' Naming ranges is number thing to do and use namemanager to help or F5 to navigate to named range F2 to edit in cell. To get VBA up <alt><f11> <alt><f10> new macro sheet? Also use record macro helps alot!I I been porting a XL Logging app to D. XL VBA is unsupported now. Easier to share install package then .xlsm today.
  9. Pat Foley

    If Then dilema

    If subroutines mean procedures and functions also lists arrays and what not. Marco Cantu has some free books out there. Delphi has help built in plus source. For now take a Tshape and drop it in the design window. Use the F11 key to change the Brush and Pen Properties this makes a nice card back. In code window find Shape1: TShape; Hold down the control<key>to underline TShape then cllick on it. This coding allows the Tshape to be made. Study how the paint works with pen and brush. Calendar1: TCalendar; Is another one that shows how change properties and a grid as well. You not needing to make a control now just examine the plumbing.
  10. Pat Foley

    Hints on debug and release build

    Also have same issue with .DCRs There clean removes your reg settings. Trying your suggestion out initial 59k dropped to 9k a working import is around 11k
  11. Pat Foley

    Hints on debug and release build

    Me too. My workaround is not use default Debug Release directories. That is import project .DPR from old D or Laz then new D generates a well behaved .proj
  12. Pat Foley

    Hints on debug and release build

    DCUs are only recompiled when they are not found or a build all command is sent. Delphi may be doing this for you each time you switch from Debug to Release. If they are not recompiled no hints are generated. Allowing faster compile times 🙂
  13. Pat Foley

    ways to organize related code in a form?

    From diaper to diapered. What happens in between is accommodation by family, teachers, management, and the State. A good manager accommodates his charges needs. Consider the companion animal needed not needed. I mentioned to the boss of all the shops I worked at this was the only shop that did not have pets. More toilets can't be installed since the State requires new toilets to meet accommodation laws. The cost of Knowledge is angst. Being able to share knowledge eases that angst
  14. Pat Foley

    ways to organize related code in a form?

    You could. Deming worked on papers and was to present one at 92. Jerry Pournelle when he worked in the Aerospace industry said they hired people of lower intelligence to connect the wiring harnesses in airplanes since they could focus on this mind numbing work and were happy to do it. I was at a conference at a state where a company interned high teachers vs students so the teachers would know what to teach and the importance of the students knowing communication skills. The goal is educate locally not pay finders fees and bonuses for someone that's homesick no matter what the bonus is.
  15. procedure TForm1.btnuseListUXClick(Sender: TObject); var trianglePts: TtrianglePts; // Tlist of <Points> trianglePtsExtended: TtrianglePts; begin trianglePts := TtrianglePts.Create; trianglePts.Add(point(20,20)); trianglePts.Add(point(200,100)); trianglePts.Add(point(200,20)); trianglePts.Add(point(20,20)); Canvas.Pen.Color := clgreen; Canvas.Polyline(trianglePts.List); trianglePtsExtended := TtrianglePts.Create; trianglePtsExtended.AddRange(trianglePts.ToArray); trianglePtsExtended.insert(1,point(20,100)); Canvas.Pen.Color := clRed; Canvas.Polyline(trianglePtsExtended.toarray); trianglePtsExtended.Free; trianglePts.Free; end; forgot generic example. TtrianglePts = TList<TPoint>;
  16. type ToldschoolArray = TPointerList; // array of pointer TusesSetlengthinternallyArray = TList; TtrianglePts = TList<TPoint>; ... procedure TForm1.btnmakeArrayClick(Sender: TObject); var oldSchoolArray: ToldschoolArray; things: TusesSetlengthinternallyArray; I, X, Getby: Integer; viewI, viewM: Integer; pI: PInteger; const bestguess = 10; begin x := random(10)-4; things := TusesSetlengthinternallyArray.Create; things.Capacity := bestguess; // ^setting may increase speed when 10000 + coming Try for I := 0 to pred(bestguess+x) do begin new(pI); pI^ := I; things.Add(pI); //oldSchoolArray.add(pI); can't do this :( end; oldSchoolArray := Things.List; // I was wondering why they added .list ViewI := PInteger(Things.Last)^; // guessing generics helped add this goody:) Getby := bestguess + X - 1; ViewM := PInteger(oldSchoolArray[Getby])^; caption := 'Easy:' + viewI.tostring + ' Hard:' + viewM.tostring; Finally for I := 0 to things.Count - 1 do dispose(things[I]); things.Destroy; End; Older School would be slice with oversized fixed array. To avoid DynaArray use D3.
  17. Pat Foley

    ways to organize related code in a form?

    Again thanks, It very big of you to point it out and share. Its odd to just listen first for a change.
  18. 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.
  19. Pat Foley

    gem found in vcl.forms

    More annoying is self.FScaled :(
  20. 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.
  21. 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
  22. 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
×