English
Source / code snippets

Button dialog Window Gr

 
Button:

Andreas Miethe (21.09.11)
This will usually over The Message WM_NCHITTEST geregelt.

here time one small example for a skalier / verschiebbaren Button. ought to itself well for a Window adjust let.
CompileMarkSeparation
 $H Windows.ph
 $H Messages.ph
 $H Structs.ph
STRUCT TRect         = ~Rect
STRUCT TPoint        = ~Point

Proc HitTest

    Parameters hCtl&,lParam&
    Declare Point#
    Declare Rect#
    Dim Point#,TPoint
    Dim Rect#,TRect
    Point#.x& = LoWord(lParam&)
    Point#.y& = HiWord(lParam&)
    ~ScreenToClient(hCtl&,Point#)
    ~GetWindowRect(hCtl&,Rect#)
    ~MapWindowPoints(~GetDesktopWindow(),%Hwnd,Rect#,2)

    If (Point#.y& < 4) AND (Point#.x& < 4)

        Dispose Point#,Rect#
        Return  ~HTTOPLEFT

    ElseIf (Point#.y& < 4) AND (Point#.x& >= (Rect#.right& - Rect#.left&-4))

        Dispose Point#,Rect#
        Return  ~HTTOPRIGHT

    ElseIf (Point#.y& >= (Rect#.bottom& - Rect#.top&-4)) AND (Point#.x& >= (Rect#.right& - Rect#.left&-4))

        Dispose Point#,Rect#
        Return  ~HTBOTTOMRIGHT

    ElseIf (Point#.x& < 4) AND (Point#.y& >= (Rect#.bottom& - Rect#.top& - 4))

        Dispose Point#,Rect#
        Return  ~HTBOTTOMLEFT

    ElseIf Point#.y& < 4

        Dispose Point#,Rect#
        Return  ~HTTOP

    ElseIf Point#.x& < 4

        Dispose Point#,Rect#
        Return ~HTLEFT

    ElseIf Point#.x& >= (Rect#.right& - Rect#.left& - 4)

        Dispose Point#,Rect#
        Return ~HTRIGHT

    ElseIf Point#.y& >= (Rect#.bottom& - Rect#.top& - 4)

        Dispose Point#,Rect#
        Return ~HTBOTTOM

    Else

        Dispose Point#,Rect#
        Return ~HTCAPTION

    EndIf

EndProc

SubClassProc

    If SubClassMessage(&sWnd,~WM_NCHITTEST)

        Set("WinProc", 0)
        Return HitTest(&swnd,&slParam)

    Endif

EndProc

cls
Var Ende& = 0
Var Button& = Create("Button",%hwnd,"OK",10,10,120,30)
SubClass Button&,1

whilenot ende&

    wait
/a> endwhile



Window:

Julian57 (22.09.11)
The View source with wm_ncHitTest functions really super! thanks Andreas
CompileMarkSeparation
 $H windows.ph
 $H Messages.ph
 $H Structs.ph
STRUCT TRect = ~Rect
STRUCT TPoint = ~Point

Proc HitTest

    Parameters hCtl&,lParam&
    Declare Point#
    Declare Rect#
    Dim Point#,TPoint
    Dim Rect#,TRect
    Point#.x& = LoWord(lParam&)
    Point#.y& = HiWord(lParam&)
    ~ScreenToClient(hCtl&,Point#)
    ~GetWindowRect(hCtl&,Rect#)
    ~MapWindowPoints(~GetDesktopWindow(),%Hwnd,Rect#,2)

    If (Point#.y& < 4) AND (Point#.x& < 4)

        Dispose Point#,Rect#
        Return  ~HTTOPLEFT

    ElseIf (Point#.y& < 4) AND (Point#.x& >= (Rect#.right& - Rect#.left&-4))

        Dispose Point#,Rect#
        Return  ~HTTOPRIGHT

    ElseIf (Point#.y& >= (Rect#.bottom& - Rect#.top&-4)) AND (Point#.x& >= (Rect#.right& - Rect#.left&-4))

        Dispose Point#,Rect#
        Return  ~HTBOTTOMRIGHT

    ElseIf (Point#.x& < 4) AND (Point#.y& >= (Rect#.bottom& - Rect#.top& - 4))

        Dispose Point#,Rect#
        Return  ~HTBOTTOMLEFT

    ElseIf Point#.y& < 4

        Dispose Point#,Rect#
        Return  ~HTTOP

    ElseIf Point#.x& < 4

        Dispose Point#,Rect#
        Return ~HTLEFT

    ElseIf Point#.x& >= (Rect#.right& - Rect#.left& - 4)

        Dispose Point#,Rect#
        Return ~HTRIGHT

    ElseIf Point#.y& >= (Rect#.bottom& - Rect#.top& - 4)

        Dispose Point#,Rect#
        Return ~HTBOTTOM

    Else

        Dispose Point#,Rect#
        Return ~HTCAPTION

    EndIf

ENDPROC

SubClassProc

    If SubClassMessage(&sWnd,~WM_NCHITTEST)

        Set("WinProc", 0)
        Return HitTest(&swnd,&slParam)

    Endif

ENDPROC

windowstyle 2+16+64
window 600,400
cls 255
var dg&=Create("Window",%hwnd,"",10,10,200,100)
StartPaint dg&
cls 255
EndPaint
SubClass dg&,1
SubClass %hwnd,1

while 1

    waitinput 30
    case iskey(27) : end

endwhile


 
09/22/11  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.912 Views

Untitledvor 0 min.
RudiB.09/03/22
Michael Hettner08/27/21
Frank04/16/21
Member 389165709/22/18
More...

Themeninformationen

this Topic has 1 subscriber:

iF (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie