Loading ...
Sorry, an error occurred while loading the content.
 

Re: [libertybasic] Re: More about Question of CURSOR command

Expand Messages
  • bbjen@hotPOP.com
    That is COOL! The cursor coordinates are returned from anywhere on the screen, independent of open windows. Bill J. ... but now it appears that I need to
    Message 1 of 7 , May 2, 2003
      That is COOL!
      The cursor coordinates are returned from anywhere on the screen,
      independent of open windows.

      Bill J.
      ------------------------------------------------------

      At 07:46 PM 5/2/03 -0000, you wrote:
      >Thanks, Brian, that's kind of what I was trying to do. I modified your
      example to show what I wanted (see code below). Two main points:
      >
      >1) I was hoping I could get the job done with standard BASIC commands;
      but now it appears that I need to become familiar with calldll's and api's.
      What is the best way to do this? Where are these calls listed and described?
      >
      >2) In my example code below, I had to come up with some fudge factors to
      take into account the real position of the graphics box within the window.
      These offsets (+5 in x, and +24 in y) are apparently needed because of the
      window's frame. Such tactics make pixel-related coding quite tedious since
      for example a graphics box does not appear at the x,y you thought it should
      because of the effect of a window's frame -- and you can't remove the frame
      from a regular window.
      >
      >Thanks again -- you've provided me with a good solution!
      >
      >Paul Friedl
      >
      >
      >nomainwin
      >WindowWidth = 400
      >WindowHeight =400
      >UpperLeftX = 1
      >UpperLeftY = 1
      >gHeight=160
      >gWidth=150
      >UpperGX=20
      >UpperGY=30
      >graphicbox #aWindow2.g,UpperLeftX+UpperGX,UpperLeftY+UpperGY,gWidth,gHeight
      >
      >struct point, x as long, y as long
      >statictext #aWindow2.text, "", UpperGX+25, UpperGY+55, 100, 30
      >open "Track Cursor" for window as #aWindow2
      >print #aWindow2, "trapclose [end]"
      >print #aWindow2.g,"when leftButtonDown [end]"
      >print #aWindow2.g,"setfocus;down"
      >print #aWindow2.g,"fill yellow"
      >open "user32" for dll as #user
      >timer 50,[catch]
      >
      >[catch]
      >calldll #user, "GetCursorPos", _
      >point as struct, _
      >result as void
      >
      >x = point.x.struct
      >y = point.y.struct
      >
      >print #aWindow2.text, x; ", "; y
      >if (x>=UpperGX+UpperLeftX+5) and (x<=UpperGX+gWidth+UpperLeftX+5)_
      > and (y>=UpperGY+UpperLeftY+24) and (y<=UpperGY+gHeight+UpperLeftY+24)_
      > then cursor crosshair else cursor arrow
      >wait
      >[end]
      >close #user
      >close #aWindow2
      >END
      >
    • Brian
      Well...For the Calldll s and API s Alyces Website is tops for examples (thanks as always Alyce your website is awesome and a HUGE help ) plus alot of good
      Message 2 of 7 , May 2, 2003
        Well...For the Calldll's and API's Alyces Website is tops for examples
        (thanks as always Alyce your website is awesome and a HUGE help )
        plus alot of good people on the news group have websites with they're own examples
        plus watch for and read the news letters they produce (Great News Letter guys ! )
        these are full of great snips and fantastic info that comes in handy down the road
        also the http://libertybasic.conforums.com/index.cgi has a wealth of info
        you can also do a search through the yahoo groups ...

        not to mention http://www.mentalis.org/index2.shtml 900 + API calls in VB
        that you can port to LB

        Glad i could Help : )
        Brian


        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.