Announcement

Collapse
No announcement yet.

Graphic Window Scrolling

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Graphic Window Scrolling

    This is my 1st time playing with the Graphic Window.

    Does anyone have any good examples to start with?
    Particularly at the moment I am playing with Set Pixel and drawing lines, but can not for the life of me find how to add scrollbars so I could make a line drawing representing a motion profile, or simulate waves (Triangle, Square-Wave, Trapazoid, etc)

    I do have a good start from Paul Dixon's waves, but it too only stays inside the size of the Graphic Window.

    (One side question, is the smallest unit in the window a pixel? or will I need to consider scaling later on????)

    For the time being I would be happy with figuring out how to scroll. and learn more from other examples of how a graphic window is used.
    Engineer's Motto: If it aint broke take it apart and fix it

    "If at 1st you don't succeed... call it version 1.0"

    "Half of Programming is coding"....."The other 90% is DEBUGGING"

    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

  • #2
    Cliff, it doesn't appear that GW has Styles, so my bet would be there is no inherernt scrolling.

    ================================================
    "The instinct of nearly all societies is
    to lock up anybody who is truly free.
    First, society begins by trying to beat you up.
    If this fails, they try to poison you.
    If this fails too,
    they finish by loading honors on your head."
    Jean Cocteau (1889-1963)
    ================================================
    It's a pretty day. I hope you enjoy it.

    Gösta

    JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
    LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

    Comment


    • #3
      Cliff,
      try this:
      http://www.powerbasic.com/support/pb...66&postcount=9

      Make sure you choose a bitmap image bigger than the window then use the arrow keys to scroll.

      Paul.

      Comment


      • #4
        Graphic Scrolling

        I have a DDT graphic scrolling window example that scrolls using ScrollDC with a time stamp reflecting current time, and simulated inputs. I recently wrote it as an example for a friend. I am not ready to post the source code yet, but if you want a copy of the source code so that you can work with it, Cliff, then contact me at [email protected]

        regards, Ian
        Attached Files
        :) IRC :)

        Comment


        • #5
          Absolutely LOVE the demo Ian

          Could you send a copy to [email protected]
          or
          [email protected]

          Or even send me a PM (Not sure if that allows attachments though)

          I would be extremely grateful

          Some of it may be a bit beyond what I am thinking, but it definitely shows me that "Concepts" are possible (stuff I was thinking about once I get the scrolling part down)

          Very nice executable
          Engineer's Motto: If it aint broke take it apart and fix it

          "If at 1st you don't succeed... call it version 1.0"

          "Half of Programming is coding"....."The other 90% is DEBUGGING"

          "Document my code????" .... "WHYYY??? do you think they call it CODE? "

          Comment


          • #6
            Originally posted by Ian Cairns View Post
            I have a DDT graphic scrolling window example that scrolls
            Scrolling the window as data comes in and fills the window is one thing but there are no scroll bars in the example to scroll the image. The example sparks an idea though. I'd bet one could show a portion of a large graphic in the GW, then use the $updown_class in CommCtrl to move the image around in the GW.

            Just a thought.

            ============================================================
            "A little inaccuracy sometimes saves a ton of explanation."
            H. H. Munro (Saki) (1870-1916)
            ============================================================
            It's a pretty day. I hope you enjoy it.

            Gösta

            JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
            LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

            Comment


            • #7
              scrolling

              I have to say up front I've never used a graphic window. However, the concept of scrolling lends itself to rather generic algorithims. The general technique in Windows when one is going to scroll something other than text (text is a special case of scrolling where for loops can iterate through buffers containing lines of text, and the beginning and ending lines can be incremented/decremented) is to create a child window large enough to display the totality of whatever is to be displayed, and then move the child window in relation to the parent to bring various parts of the image into view. It must be noted that the x/y coordinates of a window's position can take on negative values (this is the fundamental basis of the technique). I've posted an Sdk example of this both here & in Jose's Forum. Scroll bars present no problem and can be created in the customary manner either through Window properties or specific scroll bar controls. Here is the link to the example in Jose's Forum if anyone is interested in an Sdk example...

              http://www.jose.it-berater.org/smffo...p?topic=2981.0
              Fred
              "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

              Comment


              • #8
                Here is an example of using scrollbars with a graphic control from Steve Rossell.

                http://www.powerbasic.com/support/fo...ML/013831.html
                Rgds, Dave

                Comment


                • #9
                  Graphic Window with scroll bars

                  Sample code to add scroll bars to a Graphic Window, posted in source code forum here..
                  http://www.powerbasic.com/support/pb...ad.php?t=40241

                  The sample shows how to use a Graphic Window as a 'view port' to scroll around a larger bit map.
                  Last edited by Dave Biggs; 29 Mar 2009, 11:46 AM. Reason: sp
                  Rgds, Dave

                  Comment


                  • #10
                    Originally posted by Dave Biggs View Post
                    Sample code to add scroll bars to a Graphic Window, posted in source code forum here..
                    http://www.powerbasic.com/support/pb...ad.php?t=40241

                    The sample shows how to use a Graphic Window as a 'view port' to scroll around a larger bit map.
                    Nifty stuff Dave.

                    ===============================================
                    "Peace is not won
                    by those who fiercely guard their differences,
                    but by those who with open minds and hearts
                    seek out connections."
                    Katherine Paterson
                    ===============================================
                    It's a pretty day. I hope you enjoy it.

                    Gösta

                    JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                    LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                    Comment


                    • #11
                      Sincere Question:

                      Why would you use a GRAPHIC WINDOW with PB/Windows instead of a GRAPHIC CONTROL on a 'regular' dialog?

                      I can see it (sort of) with a console application, but if already a GUI app...????


                      MCM
                      Michael Mattias
                      Tal Systems Inc. (retired)
                      Racine WI USA
                      [email protected]
                      http://www.talsystems.com

                      Comment


                      • #12
                        Originally posted by Michael Mattias View Post
                        Sincere Question:

                        Why would you use a GRAPHIC WINDOW with PB/Windows instead of a GRAPHIC CONTROL on a 'regular' dialog?

                        I can see it (sort of) with a console application, but if already a GUI app...????


                        MCM
                        Dunno about anyone else but I often use GW as a sort of LOUD msgbox. See the Clipboard Phone Dialer in the Programming Forum (would put the address in but the Forum editor seems to be not allowing C&P operations right now for some reason. Dunno why that happens but it does sometimes. Can't highlight either. Works fine in other programs at the same time though.).

                        =====================================================
                        "I consider the foundation of the Constitution
                        is laid on this ground:
                        That all powers not delegated to the United States,
                        by the Constitution,
                        nor prohibited by it to the States,
                        are reserved to the States
                        or to the people.
                        (10th Amendment).

                        To take a single step beyond
                        the boundaries thus specifically drawn
                        around the powers of Congress,
                        is to take possession of a boundless field of power,
                        no longer susceptible to any definition." -

                        Thomas Jefferson letter to George Washington,
                        15 February, 1791
                        =====================================================

                        (Strange but the saying above is Pasted. Curious. C&P Seems to be working again. Curiouser.)

                        Here's the address for CPD http://www.powerbasic.com/support/pb...ad.php?t=40189
                        Last edited by Gösta H. Lovgren-2; 29 Mar 2009, 09:42 PM.
                        It's a pretty day. I hope you enjoy it.

                        Gösta

                        JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                        LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                        Comment


                        • #13
                          Thank you Ian for the code, works great.

                          Between your code and Steve Rossell's code, I have some research to do.

                          (Small side note I found interesting, I left your demo running over the weekend (forgot to close the window), and this morning when I went to reboot, saw the program still running (but everything was black and white with no color))
                          Just thought you may want to know in case it is ever meant to run that long.

                          Engineer's Motto: If it aint broke take it apart and fix it

                          "If at 1st you don't succeed... call it version 1.0"

                          "Half of Programming is coding"....."The other 90% is DEBUGGING"

                          "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                          Comment


                          • #14
                            Why would you use a GRAPHIC WINDOW with PB/Windows instead of a GRAPHIC CONTROL on a 'regular' dialog?
                            Why not reverse the question?

                            In any case, the answer might well be "application specific".

                            Another answer might be that you would like to make use of of the GRAPHIC WINDOW CLICK statement for something or other..
                            Rgds, Dave

                            Comment


                            • #15
                              Originally posted by Dave Biggs View Post
                              Why not reverse the question?

                              In any case, the answer might well be "application specific".

                              Another answer might be that you would like to make use of of the GRAPHIC WINDOW CLICK statement for something or other..
                              Another might be to get a painless Inkey functionality.

                              ========================================
                              "And I looked,
                              and behold a pale horse:
                              and his name that sat on him was Death,
                              and Hell followed with him."
                              Revelations 6:8
                              ========================================
                              It's a pretty day. I hope you enjoy it.

                              Gösta

                              JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                              LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                              Comment


                              • #16
                                Actually I follow MCM's line of thinking (once I get the hang of the graphic window) that if the rest of my app is GUI...why console? or window separate?

                                The answer here is..."Take the simple example, make it work, and then learn why it works" sort of attitude
                                or depending on your style

                                Lucky me, I get to look into "GRAPHICS" and make something work (and GRRRRrrrr I suck at anything graphicly and going the crayola crayon route to learn about drawing lines/squares/maybe even ovals :shhh:

                                (Anyone that teaches in any compacity, stand up for this one and take pride in a "Student FINALLLLLY gets it")
                                If it were not for my days of "When the FUBAR will I ever need this" comments (and yep I was a cocky kid when I did not understand something) I finally get a situation where I need it!!! (others I bent a bit to actually understand, but still had to be cocky out of stubborness)

                                Why graphics?? (well color flash-bangs distract the user)

                                seriously though, I have 2 possible purposes (1 to show the action of what is happening, and the other to show a picture of how the overall system works when words are not enough)

                                so I took my 1st step (and my crayon mentality of what I can understand) and attempt to build something I can learn from.

                                That said...InKeys and Graphic Print are 2 things I have to research once I learn how to draw lines at an angle
                                Engineer's Motto: If it aint broke take it apart and fix it

                                "If at 1st you don't succeed... call it version 1.0"

                                "Half of Programming is coding"....."The other 90% is DEBUGGING"

                                "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                                Comment


                                • #17
                                  I think the "loud message box" use makes some sense.

                                  (Using a GRAPHIC WINDOW just to detect clicks or keys in a gui program to me does not)

                                  I really like 'Real World' examples of applications... when it's just "how does <functionname> work?" the post reads like the compiler documentation and provides just about as much insight into "what" purpose it is serving - none.

                                  MCM
                                  Michael Mattias
                                  Tal Systems Inc. (retired)
                                  Racine WI USA
                                  [email protected]
                                  http://www.talsystems.com

                                  Comment


                                  • #18
                                    I really like 'Real World' examples of applications...
                                    Do you have any particular graphic applications in mind Michael?

                                    If you need to display a scrollable bitmap you could add scroll bar controls to a graphic control in a dialog using code similar to the sample posted by Steve.
                                    You also have the option to use a Graphic Window as in the sample code that I posted.

                                    While you cannot resize either a Graphic Control or a Graphic Window - you are able to drag a Graphic Window independently to different positions on the screen, which can be useful.

                                    You can subclass a Graphic Control to detect clicks.
                                    With a Graphic Window the functionality is built-in.

                                    Similar tools but different enough that you might want to use one instead of the other - depending on the circumstances.
                                    Rgds, Dave

                                    Comment


                                    • #19
                                      Graphics applications? Moi?

                                      I'm not a graphics guy.

                                      Hell, I can't win a game of 'Hangman' for lack of the required art skills.......
                                      Michael Mattias
                                      Tal Systems Inc. (retired)
                                      Racine WI USA
                                      [email protected]
                                      http://www.talsystems.com

                                      Comment


                                      • #20
                                        Originally posted by Michael Mattias View Post
                                        Graphics applications? Moi?

                                        I'm not a graphics guy.
                                        Ah ...., but you can graphiclly sting when you replys to (Graphic) posts.

                                        =======================================================
                                        Writing is a difficult trade
                                        which must be learned slowly by reading great authors;
                                        by trying at the outset to imitate them;
                                        by daring then to be original;
                                        by destroying one’s first productions.
                                        André Maurois
                                        =======================================================
                                        It's a pretty day. I hope you enjoy it.

                                        Gösta

                                        JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                                        LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                                        Comment

                                        Working...
                                        X