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

Re: [libertybasic] GraphicBox and Windows

Expand Messages
  • Mike Schneider
    Is there a way to run out of space using arrays? I have 5 arrays dim d as such... dim dte$(300) dim hi(300) dim lo(300) dim last(300) dim vol(300) then using
    Message 1 of 11 , Sep 3, 2002
    • 0 Attachment

      Is there a way to run out of space  using arrays?

      I have 5 arrays dim'd as such...

      dim dte$(300)

      dim hi(300)

      dim lo(300)

      dim last(300)

      dim vol(300)

      then using the same arrays over and over again, I open up and fill the array 3000 times...

      Will this cause any problems in LB?

      Mike...

       "A. Watson" wrote:

      At 01:24 AM 9/3/02 -0000, you wrote:
      >    Is there a way to get rid of the box surrounding the bmp pic in the
      > graphicbox?


      Yes, if you use API calls.  Remove the border before attempting to draw
      anything in the graphicbox.  Demo below.


      > When Windows are moved on the screen, is there a way to find out the
      > new location of the Window?


      There is no way to trap the event of a window being moved.  There are api
      calls such as GetWindowRect that can retrieve information about the window,
      but you would need to check the window placement on a timer and see if the
      coordinates had changed, to determine if the user had moved the window.

      Regards,
      Alyce


      'borderless graphicbox
      nomainwin

      filedialog "Choose Bmp","*.bmp",bmp$
      if bmp$="" then end

      loadbmp "pic",bmp$

      graphicbox #1.g, 10,10,100,100
      open "Test" for window_nf as #1
      hGbox=hwnd(#1.g)    'graphicbox handle

      hStyle=GetWindowLong(hGbox,_GWL_STYLE)
      hNewStyle=SetWindowLong(hGbox,_GWL_STYLE, hStyle XOR _WS_BORDER)

      print #1.g, "down;drawbmp pic 0 0;flush"

      unloadbmp "pic"
      WAIT


      Function GetWindowLong(hWin, type)
          calldll #user32,"GetWindowLongA",_
              hWin As long,_
              type As long,_
              GetWindowLong as long
          End Function

      Function SetWindowLong(hWin, type, newVal)
          calldll #user32, "SetWindowLongA",_
              hWin as long,_
              type as long,_
              newVal as long,_
              SetWindowLong as long
          End Function



      To unsubscribe from this group, send an email to:
      libertybasic-unsubscribe@egroups.com



      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
    • carlgundel
      ... the array 3000 times... ... No. This should not be a problem. -Carl
      Message 2 of 11 , Sep 3, 2002
      • 0 Attachment
        --- In libertybasic@y..., Mike Schneider <mikeschn@a...> wrote:
        >
        > Is there a way to run out of space using arrays?
        > I have 5 arrays dim'd as such...
        > dim dte$(300)
        > dim hi(300)
        > dim lo(300)
        > dim last(300)
        > dim vol(300)
        > then using the same arrays over and over again, I open up and fill
        the array 3000 times...
        > Will this cause any problems in LB?

        No. This should not be a problem.

        -Carl
      • lazman2001
        ... This has crossed my mind a time or to also. I have never really need to do it though, so I haven t tried to figure it out. Alyce, This is really neat. Just
        Message 3 of 11 , Sep 3, 2002
        • 0 Attachment
          --- In libertybasic@y..., "A. Watson" <alycewatson@c...> wrote:

          This has crossed my mind a time or to also. I have never really need
          to do it though, so I haven't tried to figure it out.

          Alyce, This is really neat. Just two calls and you can change the
          style of an object. This could come in handy! I wonder if it is
          possible to change the style of other windows in another program
          using this method? Such as adding resizing handles to buttons or
          other controls in Iexplorer or some other program?

          I will have more time later to play around with it. Thanks for
          shareing your code!

          ~laz




          > At 01:24 AM 9/3/02 -0000, you wrote:
          > > Is there a way to get rid of the box surrounding the bmp pic
          in the
          > > graphicbox?
          >
          >
          > Yes, if you use API calls. Remove the border before attempting to
          draw
          > anything in the graphicbox. Demo below.
          >
          >
          > > When Windows are moved on the screen, is there a way to find out
          the
          > > new location of the Window?
          >
          >
          > There is no way to trap the event of a window being moved. There
          are api
          > calls such as GetWindowRect that can retrieve information about the
          window,
          > but you would need to check the window placement on a timer and see
          if the
          > coordinates had changed, to determine if the user had moved the
          window.
          >
          > Regards,
          > Alyce
          >
          >
          > 'borderless graphicbox
          > nomainwin
          >
          > filedialog "Choose Bmp","*.bmp",bmp$
          > if bmp$="" then end
          >
          > loadbmp "pic",bmp$
          >
          > graphicbox #1.g, 10,10,100,100
          > open "Test" for window_nf as #1
          > hGbox=hwnd(#1.g) 'graphicbox handle
          >
          > hStyle=GetWindowLong(hGbox,_GWL_STYLE)
          > hNewStyle=SetWindowLong(hGbox,_GWL_STYLE, hStyle XOR _WS_BORDER)
          >
          > print #1.g, "down;drawbmp pic 0 0;flush"
          >
          > unloadbmp "pic"
          > WAIT
          >
          >
          > Function GetWindowLong(hWin, type)
          > calldll #user32,"GetWindowLongA",_
          > hWin As long,_
          > type As long,_
          > GetWindowLong as long
          > End Function
          >
          > Function SetWindowLong(hWin, type, newVal)
          > calldll #user32, "SetWindowLongA",_
          > hWin as long,_
          > type as long,_
          > newVal as long,_
          > SetWindowLong as long
          > End Function
        • A. Watson
          ... laz, this method is documented in an old newsletter. Yes, you can use it to change certain styles, but always remember that some controls are special to
          Message 4 of 11 , Sep 3, 2002
          • 0 Attachment
            At 12:41 PM 9/3/02 -0000, you wrote:
            > ""<> wrote:
            >
            > This has crossed my mind a time or to also. I have never really need
            > to do it though, so I haven't tried to figure it out.
            >
            > Alyce, This is really neat. Just two calls and you can change the
            > style of an object. This could come in handy! I wonder if it is
            > possible to change the style of other windows in another program
            > using this method? Such as adding resizing handles to buttons or
            > other controls in Iexplorer or some other program?
            >
            > I will have more time later to play around with it. Thanks for
            > shareing your code!

            laz, this method is documented in an old newsletter. Yes, you can use it
            to change certain styles, but always remember that some controls are
            special to LB and are not standard Windows controls, so this method won't
            work in some instances. I wasn't sure that it would work for a graphicbox
            until I wrote the demo for the person who asked on this forum. To add a
            style bit to the style, use the OR bitwise operator. To remove one, use XOR.

            As for adding resizing handles to buttons, well, since that isn't a part of
            the BUTTON class, I doubt it would work, but I've been wrong plenty of
            times before this. You'll just have to experiment.

            Alyce




            .
          • dennis_mckinney
            If you don t mind using the WMliberty.dll here s one way to detect the movement of a window. As Alyce pointed out you would still need to get the new
            Message 5 of 11 , Sep 3, 2002
            • 0 Attachment
              If you don't mind using the WMliberty.dll here's one way to detect
              the movement of a window. As Alyce pointed out you would still need
              to get the new size/coords with GetWindowRect.

              Dennis

              '-- code --
              nomainwin

              Open "WMLiberty.dll" For DLL As #wmlib

              open "Test Size / Move Message" for window as #1
              print#1, "trapclose [quit]"
              hWin = hwnd(#1)
              hWin(0) = hWin
              Callback lpfnOnMove, OnMove(long,long,long,long),long
              CallDLL #wmlib, "SetWMHandler", hWin As long, _WM_EXITSIZEMOVE As
              long, _
              lpfnOnMove As long, 0 As long, ret As long

              [loop]
              Scan
              GoTo [loop]

              [quit]
              close #1
              close #wmlib
              end

              Function OnMove( hWnd, uMsg, wParam, lParam )
              If uMsg = _WM_EXITSIZEMOVE AND hWnd = hWin(0) then
              Notice "Window Moved or Resized"
              End If
              End Function


              --- In libertybasic@y..., "BanisterK" <banisterk@y...> wrote:
              > Is there a way to get rid of the box surrounding the bmp pic in the
              > graphicbox?
              >
              > When Windows are moved on the screen, is there a way to find out
              the
              > new location of the Window?
            • A. Watson
              ... Hi Dennis, I got the idea that the person writing the question was rather new to LB, so I didn t think about using the wmliberty.dll, but of course, that
              Message 6 of 11 , Sep 3, 2002
              • 0 Attachment
                At 01:20 PM 9/3/02 -0000, you wrote:
                > If you don't mind using the WMliberty.dll here's one way to detect
                > the movement of a window. As Alyce pointed out you would still need
                > to get the new size/coords with GetWindowRect.
                >
                > Dennis


                Hi Dennis,

                I got the idea that the person writing the question was rather new to LB,
                so I didn't think about using the wmliberty.dll, but of course, that is a
                terrific idea! It is very easy to use, and it is available in the files
                are of the lbexp forum. http://groups.yahoo.com/group/lbexp/

                In addition, I recommend that EVERYBODY go to Dennis's site, The Liberty
                Belle, and get all of the great demos and tutorials provided. Solid gold,
                and updated this very day! URL: http://libertybelle.0catch.com/

                Regards,
                Alyce




                .
              • A. Watson
                ... Small demo of GetWindowRect, modified sample from ebook. http://iquizme.0catch.com/lb/lbw3/master.html struct winRect,_ orgX as long,_ orgY as long,_
                Message 7 of 11 , Sep 3, 2002
                • 0 Attachment
                  At 01:20 PM 9/3/02 -0000, you wrote:
                  > If you don't mind using the WMliberty.dll here's one way to detect
                  > the movement of a window. As Alyce pointed out you would still need
                  > to get the new size/coords with GetWindowRect.
                  >
                  > Dennis


                  Small demo of GetWindowRect, modified sample from ebook.
                  http://iquizme.0catch.com/lb/lbw3/master.html


                  struct winRect,_
                  orgX as long,_
                  orgY as long,_
                  cornerX as long,_
                  cornerY as long

                  open "test me" for window as #main
                  print #main, "trapclose [quit]"

                  h = hwnd(#main)
                  calldll #user32, "GetWindowRect",_
                  h as long,_ 'window handle
                  winRect as struct,_ 'name of struct
                  result as boolean

                  print "Upper Left corner of 'test me' is: ";
                  print winRect.orgX.struct; ", ";winRect.orgY.struct
                  print "Lower Right corner of 'test me' is: ";
                  print winRect.cornerX.struct; ", "; winRect.cornerY.struct

                  wait

                  [quit]
                  close #main:END
                • Ingemar Bjerle
                  I downloaded from Libertybell Easy tool tips and used in one of my programs. With very little work I got it to function together with my program. I am very
                  Message 8 of 11 , Sep 3, 2002
                  • 0 Attachment
                    I downloaded from Libertybell Easy tool tips and used in one of my programs. With very little work I got it to function together with my program. I am very pleased with the result.
                    A big thanks to the guy who wrote the program and also to Alyce who recommended it!
                    Ingemar
                    ----- Original Message -----
                    From: A. Watson
                    Sent: Tuesday, September 03, 2002 6:16 PM
                    Subject: Re: [libertybasic] Re: GraphicBox and Windows

                    At 01:20 PM 9/3/02 -0000, you wrote:
                    >    If you don't mind using the WMliberty.dll here's one way to detect
                    > the movement of a window. As Alyce pointed out you would still need
                    > to get the new size/coords with GetWindowRect.
                    >
                    > Dennis


                    Hi Dennis,

                    I got the idea that the person writing the question was rather new to LB,
                    so I didn't think about using the wmliberty.dll, but of course, that is a
                    terrific idea!  It is very easy to use, and it is available in the files
                    are of the lbexp forum.  http://groups.yahoo.com/group/lbexp/

                    In addition, I recommend that EVERYBODY go to Dennis's site, The Liberty
                    Belle, and get all of the great demos and tutorials provided.  Solid gold,
                    and updated this very day!  URL:  http://libertybelle.0catch.com/

                    Regards,
                    Alyce




                    .


                    To unsubscribe from this group, send an email to:
                    libertybasic-unsubscribe@egroups.com



                    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
                  Your message has been successfully submitted and would be delivered to recipients shortly.