Page 1 of 1

dialogs show up centered globally not locally.

Posted: Thu Jul 02, 2009 3:06 pm
by superadnim
Whenever a dialog pops up it's centered (ie. to the desktop) and not to the application itself (the IDE) this makes it very annoying for those using more than one monitor or split screen, it's just way too annoying.

Is there any way this could be fixed in the editor without having to resort for third-party solutions?

By dialog I mean syntax errors, etc. MessageBox()

Posted: Thu Jul 02, 2009 3:11 pm
by freak
Well, since its a standard MessageBox() you'll have to talk to Microsoft about changing that behavior.

Posted: Thu Jul 02, 2009 3:28 pm
by superadnim
I will pretend I didn't read that answer from the staff and will continue to wait for a proper answer. Passing the ball won't fix anything.

hint: HCBT_ACTIVATE

Posted: Thu Jul 02, 2009 4:33 pm
by freak
Messing with the positioning of standard dialogs is bad practice because then the dialog stops behaving the way people are used to. Its not about "passing the ball", its about complying to the rules set up by the OS to have a good overall user experience.

Anyway, have fun pretending and waiting... :roll:

Posted: Thu Jul 02, 2009 4:57 pm
by Fluid Byte
superadnim wrote:I will pretend I didn't read that answer from the staff and will continue to wait for a proper answer.
Oh boy, the sensitivity of a butcher ... :roll:

It's actually pretty easy to fix that via API. On the other hand, you're such a dick I guess reading a little MSDN is what you really need. :wink:

Posted: Thu Jul 02, 2009 5:54 pm
by Kaeru Gaman
Fluid Byte wrote: ... the sensitivity of a butcher ...
I seen butchers crying... :twisted:

Posted: Thu Jul 02, 2009 8:25 pm
by blueznl
I took some code from user 'Eddy', below is my conversion of his code, it allows placement of any requester, AFAIK. It's Windows behaviour, by the way.

The code below is used in CodeCaddy, and seems to run fine...

Code: Select all

Procedure.i x_requesterposition_callback(window.i,message.i,wparam.i,lparam.i)               ; used for x_setrequesterposition()
  Protected result.i
  Global x_requesterposition_x.i, x_requesterposition_y.i, x_requesterposition_callback.i
  Global x_requesterposition_hook.i, x_requesterposition_window.i
  ;
  Select message
  Case #WM_DESTROY
    SetWindowLong_(window,#GWL_WNDPROC,x_requesterposition_callback)
  Case #WM_CREATE                            ; update requester position (special case for InputRequester)
    SetWindowPos_(window,#HWND_TOPMOST,x_requesterposition_x,x_requesterposition_y,0,0,#SWP_NOSIZE|#SWP_NOACTIVATE)
  Case #WM_INITDIALOG                        ; update requester position
    SetWindowPos_(Window,#HWND_TOPMOST,x_requesterposition_x,x_requesterposition_y,0,0,#SWP_NOSIZE|#SWP_NOACTIVATE)
    result = CallWindowProc_(x_requesterposition_callback,window,message,wparam,lparam)
    SetWindowPos_(Window,#HWND_TOPMOST,x_requesterposition_x,x_requesterposition_y,0,0,#SWP_NOSIZE|#SWP_NOACTIVATE)
    ProcedureReturn result
  EndSelect
  ProcedureReturn CallWindowProc_(x_requesterposition_callback,window,message,wparam,lparam)
EndProcedure

Procedure.i x_requesterposition_hook(idhook.i,wparam.i,lparam.i)                             ; used for x_setrequesterposition()
  Protected *x_requesterposition_cwp.CWPSTRUCT, windowclass.s, result.i, message.i, window.i
  Global x_requesterposition_x.i, x_requesterposition_y.i, x_requesterposition_callback.i
  Global x_requesterposition_hook.i, x_requesterposition_window.i
  ;
  *x_requesterposition_cwp.CWPSTRUCT = lParam
  message = *x_requesterposition_cwp\Message
  window = *x_requesterposition_cwp\hwnd
  ;
  ; special case for InputRequester
  ;
  windowClass = Space(255)
  GetClassName_(window,@windowclass,255)
  If LCase(windowclass)="inputrequester"
    message = #WM_INITDIALOG
  EndIf
  ;
  Select message
  Case #WM_INITDIALOG                            ; modify Requester callback
    x_requesterposition_callback = SetWindowLong_(window,#GWL_WNDPROC,@x_requesterposition_callback())
    result = CallNextHookEx_(x_requesterposition_hook, idHook,wParam,lParam)
    UnhookWindowsHookEx_(x_requesterposition_hook)
    x_requesterposition_hook = 0
  Default
    result = CallNextHookEx_(x_requesterposition_hook,idhook,wparam,lparam)
  EndSelect
  ;
  ProcedureReturn result
EndProcedure

Procedure x_setrequesterposition(x.i,y.i,windownr.i)                                         ; set x/y position of the next purebasic requester
  Global x_requesterposition_x.i, x_requesterposition_y.i, x_requesterposition_callback.i
  Global x_requesterposition_hook.i, x_requesterposition_window.i
  ;
  ; *** set x/y position of the next purebasic requester
  ;
  ; in:        x.l       - horizontal position
  ;            y.l       - vertical position
  ;            windownr  - number of parentwindow
  ; retval:    none
  ; out:       none
  ;
  ; from the purebasic forum, by eddy, dunno how it works, or even if it works properly... :-)
  ;
  ; note: only call this with a window open! otherwise it may cause all sorts of unpredictable errors, if neccessary open
  ;       an invisible window with x_requesterposition_window = OpenWindow(#PB_Any,x,y,0,0,#PB_Window_Invisible,"")
  ;
  x_requesterposition_x = x
  x_requesterposition_y = y
  x_requesterposition_window = windownr
  ;
  ; modify parent hook
  ;
  x_requesterposition_hook = SetWindowsHookEx_(#WH_CALLWNDPROC,@x_requesterposition_hook(),GetModuleHandle_(0),GetWindowThreadProcessId_(WindowID(x_requesterposition_window),0))
  ;
EndProcedure

Posted: Thu Jul 02, 2009 8:29 pm
by Fluid Byte
What is this mess? :lol:

Posted: Thu Jul 02, 2009 8:30 pm
by Edwin Knoppert
Afaik a Windows messagebox_() *will* position itself to the screen working on.
I can test tomorrow but imo it is related to mouse or parenthwnd.

Posted: Thu Jul 02, 2009 9:11 pm
by Kaeru Gaman
the default MessageBox_() is displayed Desktop centered. I tested it.
... and APPMODAL is the default Flag, so this doesn't change anything.

... but I wonder why it shouldn't display on the second desktop if the app is there...

Posted: Fri Jul 03, 2009 5:16 am
by lexvictory
@superadnim: sounds like you're using (in nvidia terminology) "as one large horizontal desktop" (stretching the windows desktop across the two monitors)
So either switch to extended desktop mode (dualview in nvidia control panel language) or, if you have an nvidia card, go into nview properties and set the option "reposition dialog boxes on" to "move to application display" (I'm sure ati has a similar option)
If you don't like extended desktop mode; suck it up, or get something like ultramon for the "smart taskbar"
And answers like "I will pretend I didn't read that" are pretty childish. Especially when you have options like this

Posted: Fri Jul 03, 2009 8:36 am
by Edwin Knoppert
I have just tested and Windows messagebox (messagerequester) does follow the main window's monitor.

But i believe the orginal question was related to the ide and not the msgbox.