balabuev 102 Posted January 5, 2021 Still understand nothing. What is "viewer"? Share this post Link to post
Pat Foley 51 Posted January 5, 2021 Sorry viewer = "UI" "UX". Correctly the term should be viewport. Memo1.text := 'Allows this text to be viewed' Since the CB has a text and dropdown we need pass string and strings to keep it updated. The improvement is rather than passing the information each time. We simply update using the references provided in the creation of form. I suspect some programs use timers to provide updates. I will try to improve naming of the examples say 30 hours out. Share this post Link to post
balabuev 102 Posted January 5, 2021 Combo box drop-down window is not a pure "viewport". The user can actively interact with it using mouse (which is outside of the discussed topic) and keyboard. So, the user can press Up/Down arrow keys to change selected item in opened drop-down. So, from the user perspective (*) drop-down window is focused. Even in simple standard combo box. (*) User - means simple user, not technically educated. For him, the concept of focus is - simply the area, which reacts to key presses. Share this post Link to post
Pat Foley 51 Posted January 5, 2021 Quote drop-down window is focused. Even in simple standard combo box. Most users do not know that they can edit in combo box but they do know that they can see old 'text messages' with dropdown. It depends on purpose in application. Share this post Link to post
balabuev 102 Posted January 5, 2021 5 minutes ago, Pat Foley said: Most users do not know that they can edit in combo box 1) I did not said "edit". I've said - press Up/Down arrow keys to change selected item. 2) I did not said "in combo box". Instead I've said - in currently opened drop-down. That's a big difference in logic. Share this post Link to post
Pat Foley 51 Posted January 5, 2021 Quote 1) I did not said "edit". I've said - press Up/Down arrow keys to change selected item. 2) I did not said "in combo box". Instead I've said - in currently opened drop-down. That's a big difference in logic. Good points. Where I am the users don't use keyboards or even have them in some rooms. the application writes messages to combo boxes. So over the years forgot some applications would allow user to change information in a combo box. Share this post Link to post
balabuev 102 Posted January 5, 2021 (edited) So, returning to the idea, I've formulated for you: 1) The user sees "focused" opened drop-down window. 2) And the main form is "active" at the same time. And, this violates following your proposal: 23 hours ago, Pat Foley said: focus on active window is best Edited January 5, 2021 by balabuev Share this post Link to post
Pat Foley 51 Posted January 6, 2021 These forms show using CB items being created once referred then after. Showing the CB dropdown using messages. Using the CB to navigate other forms using only one list. Most of it is done by creating the ancillary form(s) in runtime. 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; Edit1: TEdit; Memo1: TMemo; mainCB: TComboBox; procedure Button1Click(Sender: TObject); procedure FormClick(Sender: TObject); procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Button2Click(Sender: TObject); procedure Memo1Change(Sender: TObject); procedure Edit1Change(Sender: TObject); procedure FormCreate(Sender: TObject); procedure mainCBChange(Sender: TObject); private { Private declarations } public { Public declarations } formsSL, Headings: Tstrings; destructor Destroy; override; end; var Form1: TForm1; implementation uses formAncillary; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin Headings.text := edit1.Text; UF.IniZ(self, formsSL, Headings); end; procedure TForm1.Button2Click(Sender: TObject); var I,C: integer; F: TForm; Ctrl: Tcontrol; begin with Screen do begin for I := 0 to formCount - 1 do // downto 0 do begin F := Forms[I]; for C := 0 to F.ComponentCount - 1 do if F.Components[C] is TCombobox then begin Ctrl := F.Components[C] as Tcontrol; F.Show; Ctrl.parent.Show; Ctrl.Show; caption := F.Name; sleep(20); Ctrl.Perform(CB_ShowdropDown,1,0); application.ProcessMessages; sleep(1200); Ctrl.Perform(CB_ShowdropDown,0,0); application.ProcessMessages; Break; end; end; Headings.Text := Headings.Text + format(' %d',[I]);//I.ToString; 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.Edit1Change(Sender: TObject); begin Headings.Text := Edit1.Text; end; procedure TForm1.FormClick(Sender: TObject); begin Caption := 'clicked by ' + (Sender as TForm).Name; Self.Show; Button1.SetFocus; end; procedure TForm1.FormCreate(Sender: TObject); begin Headings := TStringList.Create; formsSL := mainCB.items; //borrowing created list formsSL.Add(self.Name); end; procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin Caption := 'Mouse over ' + (Sender as Tcontrol).Name; end; procedure TForm1.mainCBChange(Sender: TObject); var I: integer; S: String; begin for I := 0 to Screen.FormCount - 1 do begin S := mainCB.Items[mainCB.ItemIndex]; if S <> Screen.Forms[I].name then continue else Screen.Forms[I].show; end; end; procedure TForm1.Memo1Change(Sender: TObject); begin beep; end; end. Runtime created unit formAncillary; 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 TfrmAncillary = class(TForm) Button1: TButton; Image2: TImage; remoteCB: TComboBox; procedure Button1Click(Sender: TObject); procedure remoteCBChange(Sender: TObject); procedure remoteCBDropDown(Sender: TObject); private { Private declarations } public { Public declarations } myHeadings, myLines: Tstrings; rfrmBoss: TForm; procedure IncomingTextUpdate(Sender: TObject); procedure ForwardFocus(Sender: TObject); procedure IniZ(bossForm: TForm; someLines, Headings: Tstrings); end; var UF : TfrmAncillary; implementation {$R *.dfm} procedure TfrmAncillary.Button1Click(Sender: TObject); begin beep; end; procedure TfrmAncillary.remoteCBChange(Sender: TObject); var I: integer; S: String; begin for I := 0 to Screen.FormCount - 1 do begin S := remoteCB.Items[remoteCB.ItemIndex]; if S <> Screen.Forms[I].name then continue else Screen.Forms[I].show; end; end; procedure TfrmAncillary.remoteCBDropDown(Sender: TObject); begin remoteCB.Items := myLines; remoteCB.Text := myHeadings.Text; end; procedure TfrmAncillary.ForwardFocus(Sender: TObject); begin rfrmBoss.OnClick(self); end; procedure TfrmAncillary.IncomingTextUpdate(Sender: TObject); begin remoteCB.Invalidate; end; procedure TfrmAncillary.IniZ(bossForm: TForm; someLines, Headings: Tstrings); begin Application.CreateForm(TfrmAncillary, UF); with UF do begin mylines := someLines; myHeadings := Headings; remoteCB.Items := someLines; name := 'UF_' + Screen.FormCount.ToString; myLines.Add(name); Caption := name; setbounds(10,20,360,270); rfrmBoss := bossForm; onclick := ForwardFocus; onmousedown := nil; onmouseMove := bossForm.OnMouseMove; Color := RGB(random(255),random(255),random(255)); show; end; end; end. 1 Share this post Link to post
balabuev 102 Posted January 6, 2021 I see nothing interesting in your code. You still not even trying to explain what exactly you want to show? At least, how this code should be used step by step, and what should we see as a result? Just for fun: attach zipped sources. Share this post Link to post
Pat Foley 51 Posted January 6, 2021 Here's a screen shot of code realized. 1 Share this post Link to post