English
Forum

position and dimensions one Buttons detect

 
- Page 1 -



Michael
Hettner
Hi,
how can I The position and the dimensions one Buttons in the Mainwindow detect?
 
08/27/21  
 



« this Posting watts as Solution marked. »


Thomas
Freier
I use mostly:
 $H windows.ph
 $H messages.ph
STRUCT RECT = Left&,Righ&,Top&,Bottom&
Declare appexit%
Window Style $003F
Window Title "anklicken and move "
Window 207,114 - 771,611
Cls ~GetSysColor(15)
UseFont "MS Sans Serif",13,0,0,0,0
SetDialogFont 1
Var Text& = Create("Text",%hwnd,"veschieb mich",10,10,100,24)
Var Group& = Create("Group box",%hwnd,"veschieb mich",240,240,300,300)
Var Button& = Create("Button",%hwnd,"veschieb mich",140,10,100,24)
Var R# = New(RECT)

WhileNot appexit%

    WaitInput
    ~EnumChildWindows(%hwnd,ProcAddr("MoveIt",2),MakeLong(%mousex,%mousey))

    If %key = 2

        Dispose hdr#
        Dispose R#
        appexit%=1

    Endif

EndWhile

Proc MoveIt

    Parameters wnd&,lParam&
    ~GetClientRect(wnd&,R#)
    ~MapWindowPoints(wnd&,%hwnd,R#,2)

    If ~PtInRect(R#,LoWord(lParam&),HiWord(lParam&))

        ~Capture Release()
        UseCursor 5
        SendMessage(wnd&,~WM_SYSCOMMAND,~SC_MOVE+1,0)
        UseCursor 0
        Return 0

    endif

    Return 1

ENDPROC

 
Gruß Thomas
Windows XP SP2, XProfan X2
08/28/21  
 




p.specht

want You whom Button platzieren? with mouse left upper corner start and by %mousex, %mousey read. Gleiches with it rechten downstairs corner, the gives then minus the before ausgelesenen values The Size.

with Buttons in strangers Programmtexten müsstes You the lever know, then would it presumably plainer. In suit Programs do you know Yes The values, The You at Create uses have already ...
 
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
08/27/21  
 




Michael
Hettner
The Buttons can in my Program spare moved go. The positions should then in a INI-File written go, so the at next Programmaufruf the Buttons again on the equal stain find.
 
08/27/21  
 




RudiB.
probiers time with setWindowPos lever,%mousex,%mousey
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
08/27/21  
 




RudiB.
Have what found... [...] 

still into Whilenot ende& Loop to the Waitinput
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
08/27/21  
 




H.Brill
The dimensions weg Yes simply :
Declare lever btn1, btn2, btn3, Long end
Window 600, 400
btn1 = Create("Button", %HWnd, "Button1", 10, 10, 80, 25)
btn2 = Create("Button", %HWnd, "Button2", 10, 50, 70, 25)
btn3 = Create("Button", %HWnd, "Ende",    10, 90, 50, 25)
end = 0

Whilenot end

    WaitInput

    If Clicked(btn1)

        MessageBox("Breite Btn1 : " + Str $(Width(btn1, 1)) + "\nHöhe Btn1 : " + Str $(Height(btn1, 1)), "Info", 0)

    ElseIf Clicked(btn2)

        MessageBox("Breite Btn2 : " + Str $(Width(btn2, 1)) + "\nHöhe Btn2 : " + Str $(Height(btn2, 1)), "Info", 0)

    ElseIf Clicked(btn3)

        MessageBox("Breite Btn3 : " + Str $(Width(btn3, 1)) + "\nHöhe Btn3 : " + Str $(Height(btn3, 1)), "Info", 0)
        end = 1

    EndIf

EndWhile

End

And so The relativen Coordinates :
Declare lever btn1, btn2, btn3, Long end, rect#
Def GetWindowRect(2) !"USER32", "GetWindowRect"
Struct Brect = left&, top&, right&, bottom&
Dim Rect#, Brect
Window 600, 400
btn1 = Create("Button", %HWnd, "Button1", 10, 10, 80, 25)
btn2 = Create("Button", %HWnd, "Button2", 10, 50, 70, 25)
btn3 = Create("Button", %HWnd, "Ende",    10, 90, 50, 25)
end = 0

Whilenot end

    WaitInput

    If Clicked(btn1)

        GetWindowRect(btn1, Rect#)
        MessageBox("X1 : " + Str $(Rect#.left&) + "\nY1 : " + Str $(Rect#.top&) + "\nX2 : " + Str $(Rect#.right&) + "\nY2 : " + Str $(Rect#.bottom&), "Info", 0)

    ElseIf Clicked(btn2)

        GetWindowRect(btn2, Rect#)
        MessageBox("X1 : " + Str $(Rect#.left&) + "\nY1 : " + Str $(Rect#.top&) + "\nX2 : " + Str $(Rect#.right&) + "\nY2 : " + Str $(Rect#.bottom&), "Info", 0)

    ElseIf Clicked(btn3)

        GetWindowRect(btn3, Rect#)
        MessageBox("X1 : " + Str $(Rect#.left&) + "\nY1 : " + Str $(Rect#.top&) + "\nX2 : " + Str $(Rect#.right&) + "\nY2 : " + Str $(Rect#.bottom&), "Info", 0)
        end = 1

    EndIf

EndWhile

Dispose Rect#
End

ought to one then only because of the Window converting, or.
this respect.
 
Benutze XPROFAN X3 + FREEPROFAN
Wir sind die XProfaner.
Sie werden von uns assimiliert.
Widerstand ist zwecklos!
Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.

Was die Borg können, können wir schon lange.
08/28/21  
 




Michael
Hettner
thanks, the functions. ;)
 
08/28/21  
 




p.specht

I would very on the Programmteil interested, with the Buttons moved go can. on the principle at least. me falls only Delete and new Create on Mausposition one (in XProfan-11.2a free) ...
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
08/28/21  
 




Thomas
Freier
I use mostly:
 $H windows.ph
 $H messages.ph
STRUCT RECT = Left&,Righ&,Top&,Bottom&
Declare appexit%
Window Style $003F
Window Title "anklicken and move "
Window 207,114 - 771,611
Cls ~GetSysColor(15)
UseFont "MS Sans Serif",13,0,0,0,0
SetDialogFont 1
Var Text& = Create("Text",%hwnd,"veschieb mich",10,10,100,24)
Var Group& = Create("Group box",%hwnd,"veschieb mich",240,240,300,300)
Var Button& = Create("Button",%hwnd,"veschieb mich",140,10,100,24)
Var R# = New(RECT)

WhileNot appexit%

    WaitInput
    ~EnumChildWindows(%hwnd,ProcAddr("MoveIt",2),MakeLong(%mousex,%mousey))

    If %key = 2

        Dispose hdr#
        Dispose R#
        appexit%=1

    Endif

EndWhile

Proc MoveIt

    Parameters wnd&,lParam&
    ~GetClientRect(wnd&,R#)
    ~MapWindowPoints(wnd&,%hwnd,R#,2)

    If ~PtInRect(R#,LoWord(lParam&),HiWord(lParam&))

        ~Capture Release()
        UseCursor 5
        SendMessage(wnd&,~WM_SYSCOMMAND,~SC_MOVE+1,0)
        UseCursor 0
        Return 0

    endif

    Return 1

ENDPROC

 
Gruß Thomas
Windows XP SP2, XProfan X2
08/28/21  
 




p.specht

fully krass extrageil! thousand Thanks, Thomas!
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
08/28/21  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.441 Views

Untitledvor 0 min.
Georg Teles05/14/24
Sven Bader11/21/23
Michael Hettner09/21/23
Axel Berse08/13/23
More...

Themeninformationen



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