Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Main";
Current archive: 2002.11.14;
Download: [xml.tar.bz2];

Down

Emulate focus on internal form Find similar branches


Strumpf   (2002-11-04 22:05) [0]

On Form, there is Panel1. In Form1.FormCreate:
Form2: = TForm.Create (Form1); Form2.Parent: = Panel1; Form2.Show;
How to make focus pass (or emulate) to Form2?



down   (2002-11-04 22:19) [1]

Form2.SetFocus does not help?



Strumpf   (2002-11-04 22:31) [2]

> down (04.11.02 22: 19)

Doesn’t help: ((. The fact is that Form1 has focus in any case (I think so).



down   (2002-11-04 22:33) [3]

And if in OnShow for Form2 write?



Strumpf   (2002-11-04 22:41) [4]

> down (04.11.02 22: 33)

Does not help. Actually, I need to emulate the MDI mode.



down   (2002-11-04 23:10) [5]

You can set focus on some Form2 control in OnShow, but in general, of course, weird fun.



Lexa1900   (2002-11-04 23:15) [6]

Mona is still like that

var h: hwnd;
begin
h: = FindWindow ("TForm2", nil); {instead of nil, you can write the program’s caption, which is more reliable, eg: h: = FindWindow (nil, "My program"); }
SetActiveWindow (h);

end;



Strumpf   (2002-11-04 23:17) [7]

> down (04.11.02 23: 10)
Yes, everything is very simple. There is a basic form - the main one. And several forms located inside an element on the main form (for example, a panel) - the workspace. These forms are created programmatically and any of them can become active. In order to visually see what kind of input focus should be emulated on it. You can, of course, manually draw a capture strip, but this is an extreme case. There is a possibility of these actions for MDI. But it is necessary that all the windows are located on the workspace. And through MDI this is not feasible ...



Alex4444444444   (2002-11-04 23:27) [8]

SetForegroundWindow ne pomogaet?



Strumpf   (2002-11-04 23:36) [9]

> Alex4444444444 (04.11.02 23: 27)

No.



Alex4444444444   (2002-11-04 23:45) [10]

Nu, togda, navernoe, WM_NCPAINT ... A nuzhno li ih delat "formami? Mozhet, prosto TCustomControl s TPainBox sverhu? K stati, pardon za moj russkij :), chto takoe rabochaya oblast"? Client area?



Strumpf   (2002-11-04 23:51) [11]

> Alex4444444444 (04.11.02 23: 45)
Workspace - the conditional name of the element inside the main form. No more. I have TPanel. In some programs, it seems, it was done in forms, moreover, the MDI style (??).



Alex4444444444   (2002-11-05 00:13) [12]

Ya, chestno govorya, ne proboval, no, mozhet, override
TPanel.CreateParams i vtavit "v style, chto eto --- MIDI parent?
(Ne pomnyu, kuda tochno, posmotrite help na CreateWindowEx). No, problema v tom, chto v Delphi vse peredelano (per annus), i chto-nibud "mozhet ne srabotat".



Strumpf   (2002-11-05 14:48) [13]

Anyone else advise anything worthwhile?



Song   (2002-11-05 14:50) [14]

Put Application.ShowMainForm: = False
and open form2 yourself.



Strumpf   (2002-11-05 14:54) [15]

> Song © (05.11.02 14: 50)
In this case, neither the main nor the second form will be visible :)



Song   (2002-11-05 15:00) [16]

Well then, change the main form in the project settings to form2 or put the second form to be created in dpr last, which is the same.



Strumpf   (2002-11-05 15:04) [17]

> Song © (05.11.02 15: 00)
Excuse me, did you carefully read the statement of the problem, including> Strumpf © (04.11.02/23/17 XNUMX:XNUMX)?



Song   (2002-11-05 15:13) [18]

Well, this works for me:
procedure TForm1.Button1Click (Sender: TObject);
begin
Form1.Hide;
Form2.Show;
end;

You do not have? Or didn’t I understand something again?



Strumpf   (2002-11-05 15:23) [19]

> Song © (05.11.02 15: 13)
void __fastcall TForm1 :: FormCreate (TObject * Sender) { Form = new TForm (this); Form-> Parent = Panel1; } void __fastcall TForm1 :: Button1Click (TObject * Sender) { Form1-> Hide (); Form-> Show (); }
When you click on the button, everything disappears from the screen: (((



Song   (2002-11-05 15:38) [20]

And why does the form have a parent - panel?



Strumpf   (2002-11-05 15:42) [21]

> Song © (05.11.02 15: 38)
It was necessary to make sure that Form moved around Panel1 without leaving it.



Smithson   (2002-11-05 16:13) [22]

Try TFrame. At least take a look at the implementation



MsGuns   (2002-11-05 16:42) [23]

And why, instead of “sweeping” a form with a panel, just do not handle the event of the form at its movement, comparing its coordinates with the coordinates - the borders (in this case, the panel)?



Strumpf   (2002-11-05 16:49) [24]

> MsGuns © (05.11.02 16: 42)

Of course it is possible. But at the same time, the code will be greatly inflated (and, in my opinion, completely unreasonable), because the task is that when the border of the moved form approaches the border of the panel, it is necessary to make this form “float” under the edge of the panel (which, in fact, happens when “moderating”).



Pages: 1 whole branch

Forum: "Main";
Current archive: 2002.11.14;
Download: [xml.tar.bz2];

Top





Memory: 0.62 MB
Time: 0.031 c
6-46029
Igo
2002-08-20 09:46
2002.11.14
Spelling


1-45903
vanek
2002-11-06 08:36
2002.11.14
Does anyone know how to make a * .html document?


1-45900
Noah in Delphi
2002-11-06 05:50
2002.11.14
How to scroll a StringGrid to a specific cell?


14-46137
Beginner-designer
2002-10-28 11:40
2002.11.14
How to install programs on Linux?


3-45734
DJ LLL
2002-10-24 15:01
2002.11.14
REPORT





afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic Indonesian Irish italian Japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Spanish swahili Swedish ภาษาไทย turkish Ukrainian urdu Tiếng Việt welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada Khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
zulu
English French German Italian Portuguese Russian Spanish