Author Topic: How to create a window with panes  (Read 4000 times)

NoCforMe

  • Member
  • *****
  • Posts: 1124
How to create a window with panes
« on: February 05, 2022, 01:43:15 PM »
So let's say a guy wants to create an application with a window containing several panes, something like OllyDbg, where the panes are linked together and mutually resize and all.

How would he do that? Is this something that requires Visual Studio? MFC? Can ResEd create something like this? Is it possible to "roll your own" (even though I'm sure that would be more work)? Perplexed here.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: How to create a window with panes
« Reply #1 on: February 05, 2022, 04:58:28 PM »
The magic secret is the API MoveWindow().
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

NoCforMe

  • Member
  • *****
  • Posts: 1124
Re: How to create a window with panes
« Reply #2 on: February 05, 2022, 05:28:12 PM »
The magic secret is the API MoveWindow().
You mean the function MoveWindow() in the Win32 API.  :dazzled:

But what about those nice seamless shared borders: how do you get those? Plus those dividers that you can grab and drag; those aren't normal window borders.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: How to create a window with panes
« Reply #3 on: February 05, 2022, 05:31:50 PM »
> You mean the function MoveWindow() in the Win32 API

No, I meant what I said, the API MoveWindow().
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

NoCforMe

  • Member
  • *****
  • Posts: 1124
Re: How to create a window with panes
« Reply #4 on: February 05, 2022, 05:35:35 PM »
OK, but how do you get those shared borders and dividers? Those don't just happen when you put windows next to each other.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: How to create a window with panes
« Reply #5 on: February 05, 2022, 05:41:10 PM »
GetClientRect() and/or GetWindowRect() for coordinates, then use MoveWindow() to position each child window to where you want it.

If you need to use GetWindowRect() which produces screen rather than client coordinates, you use either ScreenToClient() or the reverse ClientToScreen() to get the coordinates you need.

There is no easy way to do what you want.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

TimoVJL

  • Member
  • *****
  • Posts: 1320
Re: How to create a window with panes
« Reply #6 on: February 05, 2022, 06:35:22 PM »
Olly seems to be a MDI application.
Inside window don't have to be real dividers, an illusion is enough, as frame window can act as divider for child windows.
Only GetClientRect() and MoveWindow() are needed with some global X and Y variables.
Client windows can have their own borders / shadows.
May the source be with you

jj2007

  • Member
  • *****
  • Posts: 13957
  • Assembly is fun ;-)
    • MasmBasic
Re: How to create a window with panes
« Reply #7 on: February 05, 2022, 07:06:52 PM »
Hutch is right, there is no magic API that does the job for you - it's all MoveWindow. Probably, that is: Olly does not use standard controls. You should absolutely try WinID, it gives you a wealth of information about the controls used.

NoCforMe

  • Member
  • *****
  • Posts: 1124
Re: How to create a window with panes
« Reply #8 on: February 05, 2022, 08:34:01 PM »
I use WinSpy, which I think does about the same thing, give you info about whatever window (control) you click over.

TimoVJL

  • Member
  • *****
  • Posts: 1320
Re: How to create a window with panes
« Reply #9 on: February 05, 2022, 08:51:15 PM »
This silly program written in C have two panes.
http://masm32.com/board/index.php?topic=7483.msg81793#msg81793
With it, someone see a one way to do panes.
May the source be with you

HSE

  • Member
  • *****
  • Posts: 2501
  • AMD 7-32 / i3 10-64
Re: How to create a window with panes
« Reply #10 on: February 05, 2022, 10:55:24 PM »
There are several "mechanisms" that can be used to make those interfaces.
  • MultiWin Interface: Timo example and Olly use this mechanism, with one or more Splitters. You can resize or hide child windows, but relative position is fixed.
  • Multiple Document Interface (MDI): Is used more for repetition of similar windows, but you can make that with different windows.
  • Docking Windows: Windows can be moved to different niches or even out of application window dragging them with mouse. Very common in IDE like Visual Studio, RadAsm, EasyCode, etc
Most IDE programs use docking windows, but inside that windows they sometimes use the others mechanisms  :rolleyes:

Later I remembered that Zale don't like docking windows, then PB IDE is multiwin, with a MDI inside.
Equations in Assembly: SmplMath

Greenhorn

  • Member
  • ***
  • Posts: 493
Re: How to create a window with panes
« Reply #11 on: February 06, 2022, 01:04:44 AM »
So let's say a guy wants to create an application with a window containing several panes, something like OllyDbg, where the panes are linked together and mutually resize and all.

How would he do that? Is this something that requires Visual Studio? MFC? Can ResEd create something like this? Is it possible to "roll your own" (even though I'm sure that would be more work)? Perplexed here.

In WM_SIZE use MoveWindow or better DeferWindowPos to arrange the child windows.
https://riptutorial.com/winapi/example/8080/wm-size

Quote
OK, but how do you get those shared borders and dividers? Those don't just happen when you put windows next to each other.
There is no common control for that. In a plain Win32 application, typically the main window is responsible to do this. Or you create your own "divider control".
http://www.catch22.net/tuts/win32/splitter-windows
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: How to create a window with panes
« Reply #12 on: February 06, 2022, 06:46:06 AM »
In a single plane, think of 3 CreateWindowEx() windows side by side. The left one is a normal interface windows, the middle one is the splitter window and the right side one is another normal interface windows. The splitter window is where the control of resizing the left and right windows is performed. By using the mouse location, you can drag the splitter left or right. Within the control of the mouse moving the splitter window, you use MoveWindow() to control all 3 windows.

The left side window has its right side border changed. The splitter window maintains its width and the right side window is moved left to right with its right side border restricted to the right side of the parent window.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

wjr

  • Member
  • **
  • Posts: 247
    • WJR's website
Re: How to create a window with panes
« Reply #13 on: February 06, 2022, 08:30:09 AM »
My Skeleton - Alive and Kicking example http://wjradburn.com/software/Skeleton.zip has two child windows using the main window to process messages for the "splitter bar" which is just the space between the two panes. A similar approach could be used for more panes, but would be a bit extra work for horizontal and vertical splits as in OllyDbg.

NoCforMe

  • Member
  • *****
  • Posts: 1124
Re: How to create a window with panes
« Reply #14 on: February 06, 2022, 12:28:41 PM »
Splitter bar--that's the key thing I was looking for. Looking at "Alive and Kicking" now. Thanks!