Author |
Topic: Positioning a property sheet (Read 350 times) |
|
AlanRoberts
New Member
member is offline


Gender: 
Posts: 10
|
 |
Positioning a property sheet
« Thread started on: Dec 14th, 2015, 2:19pm » |
|
A dialog box is positioned with x,y coordinates when creating it, but a property sheet ignores all the x,y, coordinates. Is there a way to position a property sheet once it's opened?
|
|
Logged
|
Alan Roberts
|
|
|
Zaphod
Guest
|
 |
Re: Positioning a property sheet
« Reply #1 on: Dec 14th, 2015, 2:53pm » |
|
Does this work?
SYS "SetWindowPos", psh%, 0, X%, Y%, 0, 0, 5
|
|
Logged
|
|
|
|
AlanRoberts
New Member
member is offline


Gender: 
Posts: 10
|
 |
Re: Positioning a property sheet
« Reply #2 on: Dec 14th, 2015, 5:12pm » |
|
Dunno, I'll try ... I'll be back.
|
|
Logged
|
Alan Roberts
|
|
|
AlanRoberts
New Member
member is offline


Gender: 
Posts: 10
|
 |
Re: Positioning a property sheet
« Reply #3 on: Dec 14th, 2015, 5:18pm » |
|
Well, it might work, but I can't see how to use it. In the statement, what is psh%?
I created 6 versions of the property sheet so that I can reopen it with the dialog tab that was last used, so I launch it with:
PROC_showpropsheet(ShtTLCI%(ShtOpen%),DlgTLCI%())
... and have just tried:
SYS "SetWindowPos",ShtTLCI%(ShtOpen%),0,200,150,0,0,5
but that doesn't appear to do anything. I'm stumped as usual with SYS calls.
|
|
Logged
|
Alan Roberts
|
|
|
Zaphod
Guest
|
 |
Re: Positioning a property sheet
« Reply #4 on: Dec 14th, 2015, 7:05pm » |
|
The variable psh% is the handle of the property sheet that you got when you initialized it using this call from the manual: psh% = FN_newpropsheet("Property sheet",pages%,0,&20,page%())
It is the handle to the window that all the property sheets (dialogs) sit in. The property sheet container is a window like any other window so when you have its handle, as you do, you can move it and manipulate it like any other window.
The "5" in the SYS "SetWindowPos" call as the last parameter is the Windows constants SWP_NOSIZE OR SWP_NOZORDER
|
|
Logged
|
|
|
|
AlanRoberts
New Member
member is offline


Gender: 
Posts: 10
|
 |
Re: Positioning a property sheet
« Reply #5 on: Dec 14th, 2015, 9:04pm » |
|
That's what I thought, but, like I said, it doesn't seem to work. Maybe it's because it's an array element in my case. if so, then I;ll pout up with not being able to place it in exchange for the ability to open it on a nominated tab.
|
|
Logged
|
Alan Roberts
|
|
|
Zaphod
Guest
|
 |
Re: Positioning a property sheet
« Reply #6 on: Dec 14th, 2015, 9:39pm » |
|
I think you may be getting confused. To show the property sheet you called:
PROC_showpropsheet(psh%,hdlg%())
The psh% is what you want to set the position not the array of dialog handles.
|
|
Logged
|
|
|
|
AlanRoberts
New Member
member is offline


Gender: 
Posts: 10
|
 |
Re: Positioning a property sheet
« Reply #7 on: Dec 15th, 2015, 09:12am » |
|
Yes, I know about that. I have created 6 identical property sheets so that I can open with the chosen tab. So my equivalent of psh% is an array ShtTLCI%() where the argument is the number of the tab. It works fine, but the positioning doesn't.
I've just tried reverting to a single property sheet, and the SetWindowPos call still doesn't work.
|
|
Logged
|
Alan Roberts
|
|
|
AlanRoberts
New Member
member is offline


Gender: 
Posts: 10
|
 |
Re: Positioning a property sheet
« Reply #8 on: Dec 15th, 2015, 10:11am » |
|
The penny has dropped. Because it's a property sheet and not a dialog, the rules are different, so this doesn't work:
SYS "SetWindowPos",ShtTLCI%(ShtOpen%),0,600,300,0,0,5
... but this does -
SYS "SetWindowPos",!ShtTLCI%(ShtOpen%),0,600,300,0,0,5
In the same way, access to the dialog items in a normal dialog need, e.g.:
SYS "SendDlgItemMessage",!dlg%,i%,&143,0,text$
... but in a property sheet it needs -
SYS "SendDlgItemMessage",dlg%,n%,&143,0,text$
If only Richard had told me that a year ago, I wouldn't have wasted so much time. never mind, it works now.
|
|
Logged
|
Alan Roberts
|
|
|
Zaphod
Guest
|
 |
Re: Positioning a property sheet
« Reply #9 on: Dec 15th, 2015, 3:22pm » |
|
Sorry, it was me that was confused by your array of property boxes and I was making the same mistake as you.
You are absolutely right the "!" is needed. The container for which we have psh% is actually dialog which needs the indirection to get the handle. The hdlg%() has a clue in that it starts with an "h" and so it IS the handle in this case although the sheets are more dialogs. That indirection to get the handle of dialogs has caught me out so many times as well. In the case of Property sheets it really does look inconsistent.
Glad you got that sorted and it is a lesson for us all.
|
|
Logged
|
|
|
|
|