English
Forum

Done: Mouse popup menu hakt

 

Ulrich
Milde
I Have one solid verdrahtetes Program written, with the I The gleichmässige distribution of Bohrungen in a Rechteckrahmen hinbekomme. in my case goes it around the Umrahmung one Oberlichtes with LEDs, so like a Sternenhimmel. the functions so far, How one here see can. [...] 
now be I thereby, this program general umzubauen. Go goes it with the Rechteckrahmen. I use one Mausmenü, what with the rechten Key called becomes. If around the äusseren welt goes is everything ok. to that internal welt come I do not so right, because then the menu not any more called go can. yet one, CheckMenu functions apparently not unahängigen PopUp Menüs. is the so?

I slopes the Program on, into Procs Mausrechtinnen and Mausrechtaussen go only Rechtecke drawn. there kanns really not dran lying.

I thanks already times for The Help!
CompileMarkSeparation
Proc Mausrechtaussen

    Declare aktmxpos%,aktmypos%
    aktmxpos%=%mousex
    aktmypos%=%mousey

    If (aktmxpos% > myxspos%) and (aktmypos% > myyspos%)

        UsePen 0,1, RGB(255,255,255)
        Rectangle myxspos%,myyspos% - Lxpos1%, Lypos1%
        UsePen 2,1, RGB(90,53,202)
        Line myxspos%,myyspos% - %maxx, myyspos%
        Line myxspos%,myyspos% - myxspos%, %maxy
        UsePen 0,1, RGB(0,0,0)
        Rectangle myxspos%,myyspos% - aktmxpos%, aktmypos%
        Lxpos1%= aktmxpos%
        Lypos1%= aktmypos%
        DrawText %maxx - 120,3, "                                             "
        DrawText %maxx - 120,3, " X = "+ Str$(aktmxpos% - myxspos%)+ " Y = "+Str$(aktmypos% - myyspos%)

    Endif

Endproc

Proc Mausrechtinnen

    Declare aktmxpos%,aktmypos%
    aktmxpos%=%mousex
    aktmypos%=%mousey

    If (aktmxpos% > myxspos%) and (aktmypos% > myyspos%) and (Lxpos2% > aktmxpos%) and (Lypos2% > aktmypos%)

        If (Lxpos2% > aktmxpos%+2) and (Lypos2% > aktmypos%+2)

            UsePen 0,1, RGB(255,255,255)
            Rectangle myxspos%,myyspos% - Lxpos1%, Lypos1%
            UsePen 2,1, RGB(90,53,202)

        Endif

        Line myxspos%,myyspos% - %maxx, myyspos%
        Line myxspos%,myyspos% - myxspos%, %maxy
        UsePen 0,1, RGB(0,0,0)
        Rectangle myxspos%,myyspos% - aktmxpos%, aktmypos%
        Lxpos1%= aktmxpos%
        Lypos1%= aktmypos%
        DrawText %maxx - 120,3, "                                             "
        DrawText %maxx - 120,3, " X = "+ Str$(aktmxpos% - myxspos%)+ " Y = "+Str$(aktmypos% - myyspos%)

    Endif

Endproc

Declare WTitel$, Ende%, myxspos%,myyspos%, lastxpos%,lastypos%
Declare Lxpos1%,Lxpos2%,Lypos1%,Lypos2%
Declare zaussen%,zinnen%
Set("Decimals",0)
Lxpos1%=myxspos%
Lypos1%=Myyspos%
myxspos%=9
myyspos%=9
Lastxpos%=-1
zaussen%=0
zinnen%=0
WTitel$="LEDRect - grafische LED Verteilung in einem Rahmen um ein Oberlicht - 2010 by UKM "
WindowStyle 8
Window 1,1 - %maxx,%maxy
Windowtitle WTitel$
PopUp "RectangleLEDs"
AppendMenu 100, "Rechteck aussen setzen"
Appendmenu 102, "Rechteck innen setzen"
cls
UsePen 2,1, RGB(90,53,202)
Line myxspos%,myyspos% - %maxx, myyspos%
Line myxspos%,myyspos% - myxspos%, %maxy
UsePen 0,1, RGB(0,0,0)

WHILENOT ENDE%

    WAITKey

    If %KEY=2

        ENDE%= 1

    ElseIf %key=27

        Ende%=1

    ElseIf %MouseKey = 2

        CreateMenu
        AppendMenu 101,"Rechteck &aussen"
        AppendMenu 102,"Rechteck &innen"
        AppendMenu 103,"&LEDs"
        Separator
        AppendMenu 109,"&Ende"
        TrackMenu %MouseX,%MouseY

        If MenuItem(101)

            If zaussen%=0

                zaussen%=1
                Checkmenu 101,1

            Else

                zaussen%=0
                Checkmenu 101,0

            Endif

        ElseIf MenuItem(102)

            If zinnen%=0

                zinnen%=1
                zaussen%=0
                Lxpos2%=Lxpos1%
                Lypos2%=Lypos1%

            Else

                zinnen%=0
                zaussen%=1

            EndIf

        ElseIf @MenuItem(109)

            Ende% = 1

        Else

            Print "Ausgewählt:",%MenuItem

        EndIf

    Else

    EndIf

    If zaussen%=1

        Mausrechtaussen

    Endif

    If Zinnen%=1

        Mausrechtinnen
EndIf ENDWHILE
 
02/06/10  
 




Thomas
Freier
you mußt whom MenuCheck- status in a variables deposit, there it in the Loop each time new prepares becomes.
CompileMarkSeparation
declare check_1%,check_2%
..........
CreateMenu
AppendMenu 101,"Rahmen aussen"
AppendMenu 102,"Rahmen innen"
Separator
AppendMenu 103,"LED rot"
Separator
AppendMenu 109,"Ende"
CheckMenu 101,check_1%
CheckMenu 102,check_2%
TrackMenu %MouseX,%MouseY

If menuitem(101) AND (check_1%=0)

    ................
    ................
    check_1%=1

ElseIf menuitem(102) AND (check_2%=0)

    ................
    ................
    check_test2%=1   ...............
 
Gruß Thomas
Windows XP SP2, XProfan X2
02/06/10  
 




Ulrich
Milde
Yes, thankyou, I would not The idea with the variables come. the Mausmenü runs and otherwise nourish the Rechtecke increasingly the welt on, whom tappt im dunkeln form should. I häng the now already a little bit rather tickende Proggi under again on, if someone similar Problems as I should have.

thanks and tschüss
CompileMarkSeparation
Proc Rechteckaussen

    Declare aktmxpos%,aktmypos%
    aktmxpos%=%mousex
    aktmypos%=%mousey

    If (aktmxpos% > myxspos%) and (aktmypos% > myyspos%)

        UsePen 0,1, RGB(255,255,255)
        Rectangle myxspos%,myyspos% - Lxpos1%, Lypos1%
        UsePen 2,1, RGB(90,53,202)
        Line myxspos%,myyspos% - %maxx, myyspos%
        Line myxspos%,myyspos% - myxspos%, %maxy
        UsePen 0,1, RGB(0,0,0)
        Rectangle myxspos%,myyspos% - aktmxpos%, aktmypos%
        Lxpos1%= aktmxpos%
        Lypos1%= aktmypos%
        DrawText %maxx - 120,3, "                                             "
        DrawText %maxx - 120,3, " X = "+ Str$(aktmxpos% - myxspos%)+ " Y = "+Str$(aktmypos% - myyspos%)

    Endif

Endproc

Proc Rechteckinnen

    Declare aktmxpos%,aktmypos%,xdiff%,ydiff%
    aktmxpos%=%mousex
    aktmypos%=%mousey
    xdiff%=Lxpos1%-aktmxpos%

    If (aktmxpos% <= Lxpos1%) and (aktmypos% <= Lypos1%)

        UsePen 0,1, RGB(255,255,255)
        Rectangle myxspos%,myyspos% - Lxpos2%, Lypos2%
        UsePen 2,1, RGB(90,53,202)
        Line myxspos%,myyspos% - %maxx, myyspos%
        Line myxspos%,myyspos% - myxspos%, %maxy
        UsePen 0,1, RGB(0,0,0)
        Rectangle myxspos%,myyspos% - Lxpos1%, Lypos1%
        Rectangle myxspos%+xdiff%,myyspos%+xdiff% - aktmxpos%, aktmypos%
        Lxpos2%= aktmxpos%
        Lypos2%= aktmypos%
        DrawText %maxx - 270,3, "                                                                     "
        DrawText %maxx - 270,3, " XDiff = "+Str$(xdiff%)+ " X = "+ Str$(aktmxpos% - myxspos%)+ " Y = "+Str$(aktmypos% - myyspos%)

    Endif

Endproc

SET("ERRORLEVEL",1)
Declare WTitel$, Ende%, myxspos%,myyspos%, lastxpos%,lastypos%
Declare Lxpos1%,Lxpos2%,Lypos1%,Lypos2%,zeichne%
Declare zaussen%,zinnen%
Set("Decimals",0)
Lxpos1%=myxspos%
Lypos1%=Myyspos%
myxspos%=9
myyspos%=9
Lastxpos%=-1
zaussen%=0
zinnen%=0
WTitel$="LEDRect - grafische LED Verteilung in einem Rahmen um ein Oberlicht - 2010 by UKM "
WindowStyle 8
Window 1,1 - %maxx,%maxy
Windowtitle WTitel$
PopUp "RectangleLEDs"
AppendMenu 100, "Rechteck aussen setzen"
Appendmenu 102, "Rechteck innen setzen"
cls
UsePen 2,1, RGB(90,53,202)
Line myxspos%,myyspos% - %maxx, myyspos%
Line myxspos%,myyspos% - myxspos%, %maxy
UsePen 0,1, RGB(0,0,0)

WHILENOT ENDE%

    WAITKey

    If %KEY=2

        ENDE%= 1

    ElseIf %key=27

        Ende%=1

    ELSEIF %KEY=4

    ElseIf %MousePressed = 1

        If zaussen% = 1

            Rechteckaussen

        Endif

        If zinnen% =1

            Rechteckinnen

        Endif

    ElseIf %MousePressed = 2

        CreateMenu
        AppendMenu 101,"Rechteck &aussen"
        AppendMenu 102,"Rechteck &innen"
        AppendMenu 103,"&LEDs"
        Separator
        AppendMenu 109,"&Ende"
        CheckMenu 101,zaussen%
        CheckMenu 102,zinnen%
        TrackMenu %MouseX,%MouseY

        If MenuItem(101)

            If zaussen%=0

                zaussen%=1

            Else

                zaussen%=0
                Lxpos2%=9
                Lypos2%=9

            Endif

        ElseIf MenuItem(102)

            If zinnen%=0

                zinnen%=1

            Else

                zinnen%=0

            EndIf

        ElseIf @MenuItem(109)

            Ende% = 1

        Else

            Print "Ausgewählt:",%MenuItem

        EndIf

class=s4 href='./../../references-fonction/XProfan/endif/'>Endif ENDWHILE
 
02/07/10  
 



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.644 Views

Untitledvor 0 min.
Walter02/02/16
Ernst04/30/14
Andre Rohland02/11/14
Frank Vorholzer04/20/11

Themeninformationen

this Topic has 2 subscriber:

Ulrich Milde (2x)
Thomas Freier (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