Source language: Translate to:

Best position for actions properties forms

Questions about NeoBook PlugIns

Moderator: Neosoft Support

Best position for actions properties forms

Postby dec » Tue Jul 26, 2011 11:50 am

Hi Delphi developers!

In this thread, Scherzkeks said that "All Plugin-Dialogs are centered with Dual monitor. Should be centered on one Monitor ", refering to my plugin actions properties dialogs.

Well, I dont have a second monitor in order to test this issue, but know that here is some excellent plugin's developers that uses Delphi and can help me.

In fact I use the "poDesktopCenter" value for the "Position" form property in the base form for all plugins dialogs.

I remember that I use this properties for one reason, but I cant remember exactly why at this time.

So, another value for this property is more indicated? Maybe "poOwnerFormCenter"? Best of "poMainFormCenter"?

Any help is appreciated. Many thanks in advance!
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Best position for actions properties forms

Postby NeoScripter » Thu Jul 28, 2011 1:20 am

dec wrote:I remember that I use this properties for one reason, but I cant remember exactly why at this time.
I think that when using "poDesigned"/etc the editor form can behave oddly.
dec wrote:So, another value for this property is more indicated? Maybe "poOwnerFormCenter"?Many thanks in advance!
You shouldn't have any problems with "poOwnerFormCenter", unless you have a rather large editor form and the user has their NeoBook window in an odd position.

If you want the form to be centered relative to the primary screen on a dual monitor, you can use the code below;
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.Left := Trunc((GetSystemMetrics(SM_CXSCREEN) / 2) - (Form1.Width / 2));
Form1.Top := Trunc((GetSystemMetrics(SM_CYSCREEN) / 2) - (Form1.Height / 2));
end;

I recommend using "poDesktopCenter" and then executing the code above for every form's "FormCreate" event, this will have the effect that you desire.
User avatar
NeoScripter
 
Posts: 36
Joined: Fri Aug 20, 2010 3:58 pm

Postby dec » Thu Jul 28, 2011 2:06 am

Hi!

Thanks for your reply NeoScripter. I think that selecting the appropiate value for the form position property can be do this without the use of other code like you show. Fortunatelly, if the solution is that, I have a base form, that alll other forms inherits, so only one "OnCreate" event must be used.

The problem is that I not have another monitor to try. And just not use two monitor in my live. So I cant understand the behaviour when two monitors are used. But I think that the Neobook window is in one monitor and not in other. So, why I cant to center the forms on the Neobook Window? Like when you use only one monitor.

Thanks in any case for your answer NeoScripter!
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Postby Neosoft Support » Thu Jul 28, 2011 10:19 am

I usually set the form's DefaultMonitor property to "dmActiveForm", although it is unclear if this has any affect on forms created by plug-ins. I then set the Position property to "poOwnerFormCenter". Finally, I create a new copy of the form each time it is needed using the following code:

MyForm := TMyForm.CreateParented( GetActiveWindow );
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby dec » Thu Jul 28, 2011 12:40 pm

Hi to all!

Well. So I finally change the "poDesktopCenter" to "poOwnerFormCenter". Every other I do the same that NeoSoftware: "DefaultMonitor" to "dmActiveForm" (the default value) and when create a form (just when needed, and destroy just after) use the "CreateParented" with "GetActiveWindow" argument. I hope this finally solved the issue mentioned by Scherzkeks.

Thanks very very much!
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain


Return to PlugIn Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron