Announcement

Collapse
No announcement yet.

Graphic Window

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

  • Graphic Window

    What am I doing wrong? The Graphic window appears to close but is still a running process when I check processes.
    Code:
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "Win32Api.inc"
    
    FUNCTION PBMAIN () AS LONG
         LOCAL hWin AS LONG
         GRAPHIC WINDOW "Plot Points", 10, 10, 800, 800 TO hWin
         GRAPHIC ATTACH hWin, 0
         GRAPHIC CLEAR %WHITE
         GRAPHIC REDRAW
         DIALOG SHOW MODAL hWin
    END FUNCTION
    Do I need to add a callback to get the window to close for real?
    Also since this is my 1st real trial with Graphic Window, will I be able to use all I try in Graphic Window to just Graphic?

    Thanx in advance
    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
    >DIALOG SHOW MODAL hWin

    Um, that should be failing on invalid handle. DIALOG SHOW is only valid with a handle to a dialog created with DIALOG NEW.

    Since you are already experienced with PB/WIN, you might want to work with CONTROL ADD GRAPHIC instead of GRAPHIC WINDOW. I think you can get clicks by using style SS_NOTIFY on the control.
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Cliff:

      As far as I know, the GRAPHIC WINDOW is a different creature than a Dialog.

      Regards,


      Code:
       
      #COMPILE EXE
      #DIM ALL
      '#INCLUDE "C:\PBWin90\WinAPI\WIN32API.INC"
      FUNCTION PBMAIN () AS LONG
       LOCAL hWin,hVin AS LONG
       hvin=1
       GRAPHIC WINDOW "Plot Points", 10, 10, 800, 800 TO hWin
       GRAPHIC ATTACH hWin, 0,REDRAW
       GRAPHIC CLEAR %WHITE
       GRAPHIC BOX(100,100)-(700,700),0,%BLACK
      ' 
      '
       GRAPHIC REDRAW
       'dialog show modal hWin
       DO
        GRAPHIC GET DC TO hvin      'detect if the close button was pressed,
        IF hvin=0 THEN EXIT LOOP    'and exit the loop if it was, thus avoiding the process to keep running.
       LOOP
       GRAPHIC WINDOW END
      END FUNCTION
      Last edited by Manuel Valdes; 30 Jul 2009, 08:24 PM.

      Comment


      • #4
        Sample code from help file,....

        Code:
        FUNCTION PBMAIN () AS LONG
          ' Create and show a Graphic window on screen
          LOCAL hWin AS DWORD
          GRAPHIC WINDOW "Box", 300, 300, 130, 130 TO hWin
          GRAPHIC ATTACH hWin, 0
          GRAPHIC BOX (10, 10) - (120, 120), 0, %BLUE
          SLEEP 5000  ' show it for 5 seconds, then end
        END FUNCTION
        Best regards
        Jules
        www.rpmarchildon.com

        Comment


        • #5
          Since you are already experienced with PB/WIN, you might want to work with CONTROL ADD GRAPHIC instead of GRAPHIC WINDOW. I think you can get clicks by using style SS_NOTIFY on the control.
          There is also, if you are using the GRAPHIC WINDOW, the GRAPHIC WINDOW CLICK [hWin] TO click&, x!, y!
          Rod
          I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

          Comment


          • #6
            Did you try the Graphic Window End statement to see if that helped?


            GRAPHIC WINDOW END can be used to close and destroy the selected graphic window at any time. Otherwise, the window is automatically destroyed when the program ends.
            Also, when I run your code, the program ends and the process list does not show the window to still be in work.
            Last edited by Gary Beene; 30 Jul 2009, 10:21 PM.

            Comment


            • #7
              The thing is, using the GRAPHIC WINDOW requires procedural-style code.... "asking" rather than "waiting to be told" about user actions.

              I have gotten so used to the latter it's really hard to shift gears to the former.

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

              Comment


              • #8
                >But Real Programmers should be able to do both equally well ???
                Old QB45 Programmer

                Comment


                • #9
                  I know, I am only an old Engineer
                  Old QB45 Programmer

                  Comment


                  • #10
                    That gear-shifter is only one thing which does not work quite as quickly as it used to.
                    Michael Mattias
                    Tal Systems Inc. (retired)
                    Racine WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment

                    Working...
                    X