Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 MouseWhere Issues
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Sean




PostPosted: Sun Jan 13, 2008 11:55 am   Post subject: MouseWhere Issues

I've been coding a program as of late, but took out the MouseWhere part. My problem was that I wanted the program to pop up a window when Mouse_X and Mouse_Y did not = each other. But, I think I need seperate variables for detection, correct?
Sponsor
Sponsor
Sponsor
sponsor
TokenHerbz




PostPosted: Sun Jan 13, 2008 3:42 pm   Post subject: RE:MouseWhere Issues

The basic grid outline for turing is x,y. This starts at 0,0 bottom left. If you checked to see if x,y was the same, then opened a new window, it could be done with just the mousex, mousey vars. It would be at say, 1,1 / 10,10/ 50,50.

code:

setscreen("Graphics: 500;500")

var mx, my, mb: int

loop
    Mouse.Where(mx,my,mb)
    if mx = my then
        var newWindow := Window.Open("Graphics: 300;300")
       
        put "Your mouse vars where the same"
        put "location:  ", mx, " ", my
        put "Press any Key to continue..."
        Input.Pause
        Window.Close(newWindow)
    else
        put "mouse X = ", mx
        put "mouse Y = ", my
    end if
    delay(20)
    cls
end loop


thats what you wanted? somthing like that?

and a quick question, why are you using mouse vars without mouse.where?
Sean




PostPosted: Sun Jan 13, 2008 3:46 pm   Post subject: Re: MouseWhere Issues

I meant that I used to have it in, and then scratched the entire Mouse.Where stuff that I had. I then replaced it with a different code, but for my second version, I want the program to hide its windows. I can do that, then if the mouse has been moved then show window and play certain effect.

Thats what I want, I know how to do alot of mouse stuff, but this one has got me stumped.
TokenHerbz




PostPosted: Sun Jan 13, 2008 3:51 pm   Post subject: RE:MouseWhere Issues

oh, well i don't think turing is able to actually use outside vars (like tracking the mouse) when its window isn't engaged. meaning if its hiding in the back ground, it wont beable to track the mouses chords. Ofcourse i could be terribly wrong, but i'm going to try this also. Unless i still dont follow what you mean, which means im hopeless:(
TokenHerbz




PostPosted: Sun Jan 13, 2008 3:53 pm   Post subject: RE:MouseWhere Issues

oooo wait this should be good, ima play around with this and get back to you in a sec, first time i tried this and it worked, its logic seems good!

code:

var Test_Window:= Window.Open ("Graphics: 500;500")

var mx,my,mb: int

loop
    Mouse.Where(mx,my,mb)
   
    if mb = 1 then
        Window.Show(Test_Window)
    else
        Window.Hide(Test_Window)
    end if
end loop
Sean




PostPosted: Tue Jan 15, 2008 7:52 am   Post subject: Re: MouseWhere Issues

I fixed my issue. Seems i was comparing the same variable to itself, so it would never detect if it was not equal to each other. So, I made another set of variables and set their value to the stored mouse location, and it worked.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: