Splitter control

Windows specific questions.
Post Reply
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Splitter control

Post by aurelVZAB »

Hello guys
I need simple solution for win32 splitter control
i have searched around but most of them are complex or hard to translate or understand
i found this ugly piece of code which i don't get it quite well
anyone have maybe have something simple that work in FB without subclassing ?

C code :

Code: Select all

LRESULT CALLBACK windowprocessforwindow2(HWND handleforwindow, UINT msg, WPARAM wParam, LPARAM lParam)
{
    //????spiltter?,???????x
    int spos,border;
    //??????spiltter?,?spiltter???????
    int posinspiltter = 0;
    static BOOL bSplitterMoving;

    RECT rectMain,rectSpiltterH,rectRightUp;

    switch (msg)
    {
    case WM_DESTROY: {


        window2closed = true;
        return 0;
    }
    case WM_LBUTTONDOWN:

        if (handleforwindow == cHwnd[0])
        {
            MessageBox(NULL, TEXT("1??????"), TEXT("Win32_Mouse"), MB_OK);
        }else if (handleforwindow == cHwnd[1])
        {
            MessageBox(NULL, TEXT("2??????"), TEXT("Win32_Mouse"), MB_OK);
        }
        else if (handleforwindow == cHwnd[3])
        {
            MessageBox(NULL, TEXT("3??????"), TEXT("Win32_Mouse"), MB_OK);
        }
        else if (handleforwindow == cHwnd[2])
        {
            //MessageBox(NULL, TEXT("3??????"), TEXT("Win32_Mouse"), MB_OK);
            bSplitterMoving = TRUE;
            //?????,WM_MOUSEMOVE?????????????????
            SetCapture(cHwnd[0]);
            posinspiltter = GET_X_LPARAM(lParam);
            return 0;
        }
        else if (handleforwindow == cHwnd[4])
        {
            //MessageBox(NULL, TEXT("3??????"), TEXT("Win32_Mouse"), MB_OK);
            bSplitterMoving = TRUE;
            //??????
            SetCapture(cHwnd[1]);
            posinspiltter = GET_Y_LPARAM(lParam);
            return 0;
        }

        break;
    case WM_LBUTTONUP:
        ReleaseCapture();
        bSplitterMoving = FALSE;
        return 0;
    case WM_MOUSEMOVE:
        if ((wParam == MK_LBUTTON) && bSplitterMoving && (handleforwindow == cHwnd[0]))
        {
            spos = GET_X_LPARAM(lParam);
            //spos- posinspiltter  ??????????x - ?spiltter???? ????????
            MoveWindow(cHwnd[0], 0, 0, spos- posinspiltter, 480, TRUE); //???
            //spos+(5- posinspiltter)  5- posinspiltter??????spiltter??????, ??????????x + ?????spiltter???????? ????x????
            //640-(spos + (5 - posinspiltter))  640?????? - ????????,????

            MoveWindow(cHwnd[2], spos, 0, 5, 480, TRUE); //spiltter

            GetWindowRect(mHwnd, &rectMain);
            GetWindowRect(cHwnd[1], &rectRightUp);

            MoveWindow(cHwnd[1], spos + (5 - posinspiltter), 0, 640 - (spos + (5 - posinspiltter)), rectRightUp.bottom - rectMain.top - 31, TRUE); //???

            MoveWindow(cHwnd[3], spos + (5 - posinspiltter), rectRightUp.bottom- rectMain.top-31+5, 640 - (spos + (5 - posinspiltter)), 480 - (rectRightUp.bottom -     rectMain.top - 31 + 5), TRUE); //??
            MoveWindow(cHwnd[4], spos + (5 - posinspiltter), rectRightUp.bottom - rectMain.top - 31, 640 - (spos + (5 - posinspiltter)), 5, TRUE); //spiltter
        }
        else if ((wParam == MK_LBUTTON) && bSplitterMoving && (handleforwindow == cHwnd[1]))
        {
            border = GetSystemMetrics(SM_CXBORDER);
            spos = GET_Y_LPARAM(lParam);

            GetWindowRect(mHwnd, &rectMain);
            GetWindowRect(cHwnd[2], &rectSpiltterH);
            GetWindowRect(cHwnd[1], &rectRightUp);

            MoveWindow(cHwnd[1], rectRightUp.left - rectMain.left-8, 0, rectRightUp.right-rectRightUp.left, spos - posinspiltter, TRUE); //??
            MoveWindow(cHwnd[3], rectRightUp.left - rectMain.left-8, spos + (5-posinspiltter), rectRightUp.right - rectRightUp.left, 480-(spos + (5 -     posinspiltter)), TRUE); //??
            MoveWindow(cHwnd[4], rectRightUp.left - rectMain.left-8, spos - posinspiltter, rectRightUp.right - rectRightUp.left, 5, TRUE); //spiltter

        }
        return 0;
    }

    return DefWindowProc(handleforwindow, msg, wParam, lParam);
} 
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Splitter control

Post by jj2007 »

I assume you follow the parallel thread in Masm32?
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Re: Splitter control

Post by aurelVZAB »

Hi JJ
no..but i will look into it
thanks for link!
UEZ
Posts: 972
Joined: May 05, 2017 19:59
Location: Germany

Re: Splitter control

Post by UEZ »

You may find here something useful: https://stackoverflow.com/questions/556 ... er-control
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Splitter control

Post by jj2007 »

UEZ wrote: Feb 08, 2022 7:47 You may find here something useful: https://stackoverflow.com/questions/556 ... er-control
The big example by the Chinese guy fails already in lines 1+2 (#include "Win32test2.h") with error messages, and it's a whopping 416 lines long. I've posted a working example here, but a) it's Assembly and b) it's too slow, so I still have to work on the logic to get the necessary speed. However, you'll find the essential stuff in the attached source (it's only 90 lines of code): WM_SETCURSOR is your friend.
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Re: Splitter control

Post by aurelVZAB »

JJ..

do you have PowerBasic maybe ?
I found in Garry B . snippets few splitter bar examples 2 also using
scintilla control and compiled with PBWin 10 work well and fast
but i am not sure that i can modify it properly because is based on DDT
this is some kind of Dialog based wrapper for Powerbasic .
By the way i can send you a link for download ...this is
latest free version released after original author gone.

yes he ( Garry )use WM_SETCURSOR

ps here is a link to Garry Beene snippets..lot of useful api codes
http://www.garybeene.com/power/code/gbs ... _00684.htm
Last edited by aurelVZAB on Feb 08, 2022 19:02, edited 1 time in total.
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Re: Splitter control

Post by aurelVZAB »

hey jj2007

I tried your example from masm forum and work let say fine
yes some little flickering but nothing too much
for a difference i tried to meke it in o2 compiler and flickering like hell
and i mess up something with logic because i looked into C example
here is link for Powerbasic example compiled with PB code
this one not flicker and is really fast.

http://basic4all.info8-hosting.info/ind ... ;attach=49

if you cannot download it make account on my new forum..piece of cacke :)
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Splitter control

Post by jj2007 »

Hi Aurel,
Firefox doesn't allow me to download the zip, it says the connection is not secure...
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Re: Splitter control

Post by aurelVZAB »

hi jj
I use Vivaldi and i download your file from masm forum without problem
yes Stupid Firefox complain i tried with firefox too
Post Reply