| View previous topic :: View next topic |
| Author |
Message |
GuM Expert Cheater
Reputation: 0
Joined: 17 Jan 2007 Posts: 185 Location: The Netherlands
|
Posted: Mon Dec 31, 2007 1:10 pm Post subject: [Delphi] Form Always On Top problem |
|
|
Ok, I have 2 forms. On Form1, I have a button which makes Form2 visible. I want Form2 to be 'Always On Top' but when I do that I can't click anything on Form1.
| Code: | Form2.Create(Self);
//Form2.Show; //This makes it clickable but doesn't make it Always On Top
Form2.Showmodal;
SetWindowPos(Form2.Handle,
HWND_TOPMOST,
0,
0,
0,
0,
SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE); //Or "Form2.FormStyle := fsStayOnTop;" |
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 473
Joined: 09 May 2003 Posts: 25910 Location: The netherlands
|
Posted: Mon Dec 31, 2007 1:42 pm Post subject: |
|
|
do form2.show instead of form2.showmodal;
followed by setwindowpos
and form2.formstyle:=fsStayOnTop; works too
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
GuM Expert Cheater
Reputation: 0
Joined: 17 Jan 2007 Posts: 185 Location: The Netherlands
|
Posted: Mon Dec 31, 2007 2:28 pm Post subject: |
|
|
| I already tried that. It only makes Form2 stay on top of Form1. I want it to stay on top of other programs too.
|
|
| Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Mon Dec 31, 2007 9:05 pm Post subject: |
|
|
| Then use SetWindowPos.
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Tue Jan 01, 2008 2:37 am Post subject: |
|
|
button1:
form2.show; (form2.onshow, form2.formstyle:=fsstayontop;)
edit: don't forget
form2.onclose, form2.formstyle:=fsnormal;)
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Tue Jan 01, 2008 7:20 am Post subject: |
|
|
Just pot the next command in a Timer: | Code: | SetWindowPos(Form2.Handle,
HWND_TOPMOST,
0,
0,
0,
0,
SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE); |
|
|
| Back to top |
|
 |
GuM Expert Cheater
Reputation: 0
Joined: 17 Jan 2007 Posts: 185 Location: The Netherlands
|
Posted: Tue Jan 01, 2008 7:34 am Post subject: |
|
|
| HolyBlah wrote: | Just pot the next command in a Timer: | Code: | SetWindowPos(Form2.Handle,
HWND_TOPMOST,
0,
0,
0,
0,
SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE); |
|
Works, Thanks
|
|
| Back to top |
|
 |
|