Page 1 of 2

How to move a BlackBox document view to the second monitor?

Posted: Thu Apr 11, 2019 6:29 am
by Zinn
I work with BlackBox on a computer with two monitors. I can move a BlackBox form out of the main BlackBox window to the second monitor but not a BlackBox document view. I would like to move also a document to the second monitor like I can do it with the form.

How to move a BlackBox document view to the second monitor?

- Helmut

Re: How to move a BlackBox document view to the second monit

Posted: Thu Apr 11, 2019 7:40 am
by Robert
I spread my main BlackBox window over both screens.
Two monitors
Two monitors

Re: How to move a BlackBox document view to the second monit

Posted: Sun Apr 14, 2019 3:22 pm
by Zinn
Hello Robert,
How do you spread it over both screen? I can spread it over one screen only.
- Helmut

Re: How to move a BlackBox document view to the second monit

Posted: Mon Apr 15, 2019 11:47 am
by cfbsoftware
I grab the right hand edge of the window with the mouse and drag it across the gap between the two screens to the other screen.

Can you move the Blackbox window from one screen to the other? If you can do that you should be able to move it so that half is on one monitor and the other half is on the other monitor. Once you have that you should be able to resize the Window by dragging either of its sides. Note: if you click on the Maximise button it will then relocate itself to a single screen.

Re: How to move a BlackBox document view to the second monit

Posted: Mon Apr 15, 2019 4:40 pm
by Zinn
Hello Chris,
it works as you descript. Wonderful. Thank you very much for great tip.
- Helmut

Re: How to move a BlackBox document view to the second monit

Posted: Tue Apr 16, 2019 6:31 pm
by Robert
Zinn wrote:Hello Robert,
How do you spread it over both screen? I can spread it over one screen only.
- Helmut
I do use the "Drag the Window edges" method, but also do it automatically.

If I just double click on the BlackBox icon Windows gives me the same size as last time, but if I hold the <Shift> key I get my standard configuration, which is all the left monitor, and precisely enough of the right monitor for the Log.

I always increase the size of the Log, and set it to the right of the main window. (I also load a small clock into the bottom right corner; this is just a habbit.) The code to do this is in my Config module. The numbers required are got by trial and error!

Code: Select all

MODULE Config;

IMPORT Dialog, Converters, OleData, LibMisc, Windows, HostWindows, WinApi;

CONST
	logW  =  700; logH  =  800;

PROCEDURE Setup*;
...
IF LibMisc.Shift () THEN res  :=  WinApi.MoveWindow (HostWindows.main, -8, 0, 2638, 1086, 1) END;

Dialog.Call ("StdLog.Open", "", res);
Dialog.Call ("StdCmds.OpenAuxDialog ('Demo/Aclock', 'Aclock')", "", res);

Windows.dir.GetBounds (winW, winH);
LibMisc.SetWindowPlacement ('Aclock', winW - 170, winH - 187, 0, 0);
LibMisc.SetWindowPlacement ('#Dev:Log', winW - logW, 0, logW, logH);
  
PROCEDURE  Shift* () : BOOLEAN;
  BEGIN
    RETURN  WinApi.GetKeyState (WinApi.VK_SHIFT)  <  0
  END  Shift;

PROCEDURE  SetWindowPlacement* (IN title : Views.Title; x, y, w, h : INTEGER);
  VAR
    win     :  Windows.Window;
    wTitle  :  Views.Title;
    wnd     :  WinApi.HWND;
    ret     :  WinApi.BOOL;
    wp      :  WinApi.WINDOWPLACEMENT;
  BEGIN
    win  :=  Windows.dir.First ();
    WHILE  win  #  NIL  DO
      win.GetTitle (wTitle);
      IF  wTitle  =  title  THEN
        wnd  :=  win(HostWindows.Window).wnd;
        IF  (w  =  0)  &  (h  =  0)  THEN
          ret  :=  WinApi.GetWindowPlacement (wnd, wp);
          w    :=  wp.rcNormalPosition.right   -  wp.rcNormalPosition.left;
          h    :=  wp.rcNormalPosition.bottom  -  wp.rcNormalPosition.top
        END;
        ret  :=  WinApi.MoveWindow (wnd, x, y, w, h, 1);
        RETURN
      END;
      win  :=  Windows.dir.Next (win)
    END
  END  SetWindowPlacement;

Re: How to move a BlackBox document view to the second monit

Posted: Sat Apr 20, 2019 2:03 pm
by Ivan Denisov
Maybe someone will find this noMDI feature useful. It opens all documents as separate windows.
Compile Host/Mod/Windows.odc and Host/Mod/Menus.odc
Please check it in working directory or make backup of original HostMenus and HostWindows (or full Host subsystem).

Re: How to move a BlackBox document view to the second monit

Posted: Mon Apr 22, 2019 5:01 pm
by Zinn
Dear Iwan,

I tried your noMDI version and it works.
Do you use this version on your Linux computer?

I observed that my Toolbar at the top and the status bar at the bottom aren't displayed. I miss them.
Currently it is unfamiliar for me. It may changed when I work longer with it.
Another way could be to allow that a document moved out from the main window like the form can do it.

Thanks a lot for your sample.
- Helmut

Re: How to move a BlackBox document view to the second monit

Posted: Fri Apr 26, 2019 5:06 am
by Ivan Denisov
Zinn wrote:I tried your noMDI version and it works.
Do you use this version on your Linux computer?
I used it for one project, when using separate SDL2 window for 3D graphics and there was no Linux version of BlackBox.
Now I am not using it. Also I am always using one monitor, so have no such a problem with MDI when using BlackBox with Wine.
Zinn wrote:I observed that my Toolbar at the top and the status bar at the bottom aren't displayed. I miss them.
It is disappearing then no BlackBox windows have focus.[/quote]

Currently it is unfamiliar for me. It may changed when I work longer with it.
Another way could be to allow that a document moved out from the main window like the form can do it.
Zinn wrote:Thanks a lot for your sample.
Thanks for X512 for his work: http://oberspace.dyndns.org/index.php/topic,626.0.html
I just make some changes in hist version for 1.7.

Re: How to move a BlackBox document view to the second monit

Posted: Tue May 12, 2020 7:32 am
by Mobatec
I wrote a very small procedure to get any window "floating" independent of the main BlackBox window. Maybe that also helps?

PROCEDURE DecoupleChildWindow*;
(* Decouples the currently focussed child window from the Hostwindows.main, such that it can float freely over the
desktop *)
VAR
win: HostWindows.Window; style: SET;
res: INTEGER;
BEGIN
win := HostWindows.dir.Focus(Controllers.targetPath);
IF win # NIL THEN
style := BITS(WinApi.GetWindowLongW(win.wnd, WinApi.GWL_STYLE)); (* window style *)
res := WinApi.SetWindowLong(win.wnd, WinApi.GWL_HWNDPARENT, 0);
res := WinApi.SetWindowLong(win.wnd, WinApi.GWL_STYLE, ORD(style + WinApi.WS_POPUP - WinApi.WS_CHILD));
END;
END DecoupleChildWindow;