Announcement

Collapse
No announcement yet.

Graphic attach, .... Redraw

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

  • Graphic attach, .... Redraw

    GRAPHIC ATTACH, Hndl, CtrlID, REDRAW appears to work differently in 9x than in 8x. The redraw seems to happen automatically without specifically requesting GRAPHIC REDRAW.

    Is there some way to suppress this behavior?
    Walt Decker

  • #2
    Sometimes Windows may redraw the window, for example if you move the window, minimize and then maximize the window, cover it with another window then uncover it, etc. If it is something else, can you post code that exhibits this behavior or send it to support @ powerbasic.com?
    Sincerely,

    Steve Rossell
    PowerBASIC Staff

    Comment


    • #3
      Steve:

      Below is compilable code. However, without the databases no drawing will occur. Perhaps it's the way I'm implementing the routines.

      Code:
      #COMPILE EXE
      DEFLNG A - Z
      
      #IF NOT %DEF(%WINAPI)
        #INCLUDE "WIN32API.INC"
      #ENDIF
      
      %IDD_DIALOG1   =  101
      %LBX_Relations = 1001
      %LBL_Relations = 1002
      %GFX_Relations = 1003
      
      %DLG_MESS      = %WM_USER + 500
      
      $NULSPC = CHR$(0 TO 32)
      
      DECLARE FUNCTION Set_Box(BYVAL hDlg AS DWORD, BYVAL lID AS LONG, Ag$(), Sz) AS LONG
      
      
      DECLARE FUNCTION Relations_DLG(BYVAL hParent AS DWORD) AS LONG
      
      DECLARE CALLBACK FUNCTION Relations_CB()
      
      FUNCTION PBMAIN()
        Relations_DLG %HWND_DESKTOP
      END FUNCTION
      
      '------------------------------------------------------------------------------
      '   ** CallBacks **
      '------------------------------------------------------------------------------
      
      CALLBACK FUNCTION Relations_CB()
      
      STATIC NumHeads   AS DWORD
      STATIC NumDatas   AS DWORD
      STATIC Nd         AS DWORD
      STATIC TxtWide    AS DWORD
      STATIC ChrWide    AS DWORD
      STATIC ChrHigh    AS DWORD
      STATIC NumAg      AS DWORD
      
      STATIC Dstart()   AS DWORD
      STATIC Dfield()   AS DWORD
      
      STATIC Dheads()   AS STRING
      STATIC Ddat()     AS STRING
      STATIC Abbr()     AS STRING
      STATIC Ag()       AS STRING
      
      STATIC Dcat       AS STRING
      
      LOCAL DlgHnd  AS DWORD
      LOCAL CtlHnd  AS DWORD
      
      LOCAL Wparam  AS LONG
      LOCAL Lparam  AS LONG
      LOCAL CtlMess AS LONG
      LOCAL TxtHigh AS LONG
      
      LOCAL A AS STRING
      
      DlgHnd = CBHNDL
      CtlHnd = CBCTL
      
      Lparam = CBLPARAM
      Wparam = CBWPARAM
      
      SELECT CASE AS LONG CBMSG
        CASE %WM_INITDIALOG
          ' Initialization handler
          DIM Ag$(1 TO 1)
          DIM Dstart(1 TO 1)
          DIM Dfield(1 TO 1)
          DIM Dheads$(1 TO 1)
          DIM Ddat$(1 TO 1)
      
          CALL Agreements(Ag$(), NumAg)
          CALL Read_Db(CURDIR$ + "\gamedb\$Leaders.FDB", Numheads, NumDatas, Dstart(), _
                       Dfield(), Dheads$(), Dcat$, Ddat$())
          CALL Read_Db(CURDIR$ + "\gamedb\$Relations.FDB", Numheads, Nd, Dstart(), _
                       Dfield(), Dheads$(), Dcat$, Ddat$())
      
          'if Val(Mid$(Ddat$(1), Dstart(5), Dfield(5)) = 0 then
          '  DestroyWindow(DlgHnd)
          'end if
      
          Set_Box(DlgHnd, %LBX_Relations, Ag$(), NumAg)
      
          GRAPHIC ATTACH DlgHnd, %GFX_Relations, REDRAW
      
          GRAPHIC COLOR RGB(128, 0, 0), -2
          FONT NEW "courier new", 10, 3, 0, 1, 0 TO Fhndl
          GRAPHIC SET FONT Fhndl
      
          A$ = "0"
          GRAPHIC CHR SIZE TO ChrWide, ChrHigh
      
          ChrWide = ChrWide * 2
          ChrHigh = ChrHigh * 2
      
          A$ = SPACE$(Dfield(2))
          GRAPHIC TEXT SIZE A$ TO TxtWide, TxtHigh
      
          PostMessage(DlgHnd, %DLG_MESS, %LB_SETSEL, 1)
          PostMessage(DlgHnd, %DLG_MESS, %LB_GETSEL, 0)
      
        CASE %WM_NCACTIVATE
          STATIC hWndSaveFocus AS DWORD
          IF ISFALSE Wparam THEN
            ' Save control focus
            hWndSaveFocus = GetFocus()
          ELSEIF hWndSaveFocus THEN
            ' Restore control focus
            SetFocus(hWndSaveFocus)
            hWndSaveFocus = 0
          END IF
      
        CASE %WM_COMMAND
          ' Process control notifications
          CtlMess = CBCTLMSG
          SELECT CASE AS LONG CtlHnd
            CASE %LBX_Relations
              IF CtlMess = %LBN_SELCHANGE OR CtlMess = %LBN_DBLCLK THEN
                GRAPHIC CLEAR
                X = TxtWide + ChrWide
                Y = 0
      
                CONTROL GET SIZE DlgHnd, %GFX_Relations TO Gfxx, Gfxy
      
                FOR I = 1 TO NumDatas
                  A$ = RTRIM$(MID$(Ddat$(I), Dstart(2), Dfield(2)), ANY $NULSPC)
                  IF VAL(MID$(Ddat$(I), Dstart(5), Dfield(5))) = 0 THEN A$ = "?"
                  GRAPHIC SET POS(X, Y)
                  GRAPHIC PRINT A$
                  Lx! = X + TxtWide \ 2
                  Ly! = Y + ChrHigh \ 2
                  GRAPHIC LINE (Lx!, Ly!) - (Lx!, Gfxy), %BLUE
                  X = X + TxtWide + ChrWide
                NEXT I
      
                X = 0
                Y = ChrHigh
      
                FOR I = 1 TO NumDatas
                  A$ = RTRIM$(MID$(Ddat$(I), Dstart(2), Dfield(2)), ANY $NULSPC)
                  IF VAL(MID$(Ddat$(I), Dstart(5), Dfield(5))) = 0 THEN A$ = "?"
                  GRAPHIC SET POS(X, Y)
                  GRAPHIC PRINT A$
                  Lx! = X + TxtWide + ChrWide
                  Ly! = Y + ChrHigh \ 4
                  GRAPHIC LINE (Lx!, Ly!) - (Gfxx, Ly!), %BLUE
                  Y = Y + ChrHigh
                NEXT I
      
                Rad! = 4 * ATN(1)
                Rad! = Rad! / 180
                Radius = 5
      
                FOR I = 1 TO Nd
      
                  IF VAL(MID$(Ddat$(I), Dstart(5), Dfield(5))) < 1 THEN ITERATE FOR
                  A$ = RTRIM$(MID$(Ddat$(I), Dstart(2), Dfield(2)), ANY $NULSPC)
                  B$ = RTRIM$(MID$(Ddat$(I), Dstart(4), Dfield(4)), ANY $NULSPC)
                  Peace = VAL(MID$(Ddat$(I), Dstart(7), Dfield(7)))
      
                  Row = 0
                  Col = 0
      
                  FOR J = 1 TO NumDatas
                    IF VAL(MID$(Ddat$(I), Dstart(5), Dfield(5))) < 1 THEN ITERATE FOR
                    C$ = RTRIM$(MID$(Ddat$(J), Dstart(2), Dfield(2)), ANY $NULSPC)
                    IF A$ = C$ THEN
                      Row = J
                      EXIT FOR
                    END IF
                  NEXT J
      
                  FOR J = 1 TO NumDatas
                    IF VAL(MID$(Ddat$(I), Dstart(5), Dfield(5))) < 1 THEN ITERATE FOR
                    C$ = RTRIM$(MID$(Ddat$(J), Dstart(2), Dfield(2)), ANY $NULSPC)
                    IF B$ = C$ THEN
                      Col = J
                      EXIT FOR
                    END IF
                  NEXT J
      
                  Cx! = ((TxtWide + ChrWide) * Col) + TxtWide \ 2
                  Cy! = (ChrHigh * Row) + ChrHigh \ 4
                  Lx! = Cx!
                  Ly! = Cy! - Radius
      
                  GRAPHIC SET POS(Lx!, Ly!)
      
                  FOR K = 0 TO 360
                    XX! = Cx! + Radius * SIN(K * Rad!)
                    YY! = Cy! - Radius * COS(K * Rad!)
                    IF Peace > 0 THEN
                      GRAPHIC LINE (Lx!, Ly!) - (XX!, YY!), %RED
                    ELSE
                      GRAPHIC LINE (Lx!, Ly!) - (XX!, YY!), %GREEN
                    END IF
                    Lx! = XX!
                    Ly! = YY!
                  NEXT K
      
                  IF Peace > 0 THEN
                    GRAPHIC PAINT (Cx!, Cy!), %RED, %RED
                  ELSE
                    GRAPHIC PAINT (Cx!, Cy!), %GREEN, %GREEN
                  END IF
                NEXT I
      
              END IF
              'GRAPHIC REDRAW
          END SELECT
        CASE %DlG_MESS
          IF Wparam = %LB_SETSEL THEN LISTBOX SELECT DlgHnd, %LBX_Relations, Lparam
          IF Wparam = %LB_GETSEL THEN
            Wparam = MAK(DWORD, %LBX_Relations, %LBN_DBLCLK)
            CONTROL HANDLE DlgHnd, %LBX_Relations TO CtlHnd
            Lparam = MAK(DWORD, CtlHnd, 0)
            PostMessage(DlgHnd, %WM_COMMAND, Wparam, Lparam)
          END IF
      END SELECT
      
      END FUNCTION
      
      '------------------------------------------------------------------------------
      '   ** Sample Code **
      '------------------------------------------------------------------------------
      
      FUNCTION Set_Box(BYVAL hDlg AS DWORD, BYVAL lID AS LONG, Ag$(), Sz) AS LONG
      
      LOCAL I AS LONG
      
      FOR I = 1 TO Sz
        LISTBOX ADD hDlg, lID, Ag$(I)
      NEXT I
      
      END FUNCTION
      
      '------------------------------------------------------------------------------
      '   ** Dialogs **
      '------------------------------------------------------------------------------
      
      FUNCTION Relations_DLG(BYVAL hParent AS DWORD) AS LONG
      
      LOCAL lRslt AS LONG
      LOCAL hDlg  AS DWORD
      
      DIALOG NEW hParent, "Foreign Relations", 86, 55, 429, 223, %WS_OVERLAPPED _
        OR %WS_BORDER OR %WS_DLGFRAME OR %WS_CAPTION OR %WS_SYSMENU OR _
        %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_MODALFRAME OR %DS_3DLOOK OR _
        %DS_NOFAILCREATE OR %DS_SETFONT, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR _
        %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
      
      CONTROL ADD LISTBOX, hDlg, %LBX_Relations, , 5, 10, 95, 195, %WS_CHILD OR _
        %WS_VISIBLE OR %WS_TABSTOP OR %WS_VSCROLL OR %WS_HSCROLL OR %LBS_NOTIFY OR _
        %LBS_HASSTRINGS, %WS_EX_CLIENTEDGE OR %WS_EX_LEFT OR %WS_EX_LTRREADING _
        OR %WS_EX_RIGHTSCROLLBAR
      
      CONTROL ADD LABEL,   hDlg, %LBL_Relations, "War", 100, 10, 325, 10, _
        %WS_CHILD OR %WS_VISIBLE OR %SS_CENTER, %WS_EX_LEFT OR %WS_EX_LTRREADING
      
      CONTROL ADD GRAPHIC, hDlg, %GFX_Relations, "", 110, 25, 315, 195
      
      CONTROL SET COLOR    hDlg, %LBL_Relations, RGB(128, 0, 0), -1
      
      'Set_Box  hDlg, %LBX_Relations, 30
      
      DIALOG SHOW MODAL hDlg, CALL Relations_CB TO lRslt
      
      FUNCTION = lRslt
      
      END FUNCTION
      
      '------------------------------------------------------------------------------
      '------------------------------------------------------------------------------
      
      SUB Agreements(Ag$(), Sz)
      
      DATA "War"
      DATA "Preferred Trading Partner"
      DATA "Trade Embargos"
      DATA "Mutual Protection Pact"
      DATA "War Passage"
      DATA "Safe Passage"
      DATA "Trade Passage"
      DATA "Worker Passage"
      DATA "Military Alliances"
      
      Sz = DATACOUNT
      
      REDIM Ag$(1 TO Sz)
      
      FOR I = 1 TO Sz
        Ag$(I) = READ$(I)
      NEXT I
      
      END SUB
      
      '------------------------------------------------------------------------------
      '------------------------------------------------------------------------------
      
      SUB Read_Db(FPname$, Numheads, NumDatas, Ds(), Df(), Dh$(), Dct$, Ddt$())
      
      LOCAL Cnt   AS LONG
      LOCAL Offs  AS LONG
      
      Cnt = 1
      Offs = 4
      
      OPEN FPname$ FOR BINARY AS #1
      
      GET #1, Cnt, NumHeads
      Cnt = Cnt + Offs
      GET #1, Cnt, NumDatas
      Cnt = Cnt + Offs
      
      REDIM Dh$(1 TO NumHeads)
      REDIM Ds(1 TO NumHeads)
      REDIM Df(1 TO NumHeads)
      REDIM Ddt$(1 TO NumDatas)
      
      FOR I = 1 TO NumHeads
        GET #1, Cnt, Ds(I)
        Cnt = Cnt + Offs
        GET #1, Cnt, Df(I)
        Cnt = Cnt + Offs
      NEXT I
      
      FOR I = 1 TO NumHeads
        Dh$(I) = SPACE$(Df(I))
        GET #1, Cnt, Dh$(I)
        Cnt = Cnt + Df(I)
      NEXT I
      
      Dct$ = SPACE$(Ds(NumHeads) + Df(NumHeads))
      
      GET #1, Cnt, Dct$
      
      Cnt = Cnt + NumHeads
      Offs = Ds(NumHeads) + Df(NumHeads)
      
      FOR I = 1 TO NumDatas
        Ddt$(I) = SPACE$(Ds(NumHeads) + Df(NumHeads))
        GET #1, Cnt, Ddt$(I)
        Cnt = Cnt + Offs
      NEXT I
      
      CLOSE #1
      
      END SUB
      And here's a short version that displays the behavior:

      Code:
      #COMPILE EXE
      DEFLNG A - Z
      
      '------------------------------------------------------------------------------
      '   ** Includes **
      '------------------------------------------------------------------------------
      #PBFORMS BEGIN INCLUDES
      #IF NOT %DEF(%WINAPI)
        #INCLUDE "WIN32API.INC"
      #ENDIF
      #IF NOT %DEF(%COMMCTRL_INC)
        #INCLUDE "COMMCTRL.INC"
      #ENDIF
      #INCLUDE "PBForms.INC"
      #PBFORMS END INCLUDES
      '------------------------------------------------------------------------------
      
      '------------------------------------------------------------------------------
      '   ** Constants **
      '------------------------------------------------------------------------------
      #PBFORMS BEGIN CONSTANTS
      %IDD_DIALOG1  =  101
      %LBX_Relations = 1001
      %GFX_Relations = 1002
      #PBFORMS END CONSTANTS
      
      %DLG_MESS = %WM_USER + 500
      '------------------------------------------------------------------------------
      
      '------------------------------------------------------------------------------
      '   ** Declarations **
      '------------------------------------------------------------------------------
      DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
      DECLARE FUNCTION SampleListBox(BYVAL hDlg AS DWORD, BYVAL lID AS LONG, BYVAL _
        lCount AS LONG) AS LONG
      DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
      #PBFORMS DECLARATIONS
      '------------------------------------------------------------------------------
      
      '------------------------------------------------------------------------------
      '   ** Main Application Entry Point **
      '------------------------------------------------------------------------------
      FUNCTION PBMAIN()
        PBFormsInitComCtls (%ICC_WIN95_CLASSES OR %ICC_DATE_CLASSES OR _
          %ICC_INTERNET_CLASSES)
      
        ShowDIALOG1 %HWND_DESKTOP
      END FUNCTION
      '------------------------------------------------------------------------------
      
      '------------------------------------------------------------------------------
      '   ** CallBacks **
      '------------------------------------------------------------------------------
      CALLBACK FUNCTION ShowDIALOG1Proc()
      
      LOCAL DlgHnd  AS DWORD
      LOCAL CtlHnd  AS DWORD
      LOCAL DlgMess AS DWORD
      
      LOCAL Wparam  AS LONG
      LOCAL Lparam  AS LONG
      
      DlgHnd = CBHNDL
      CtlHnd = CBCTL
      
      Wparam = CBWPARAM
      Lparam = CBLPARAM
      
        SELECT CASE AS LONG CBMSG
          CASE %WM_INITDIALOG
            ' Initialization handler
            GRAPHIC ATTACH DlgHnd, %GFX_Relations, REDRAW
            PostMessage(DlgHnd, %DLG_MESS, %LB_SETSEL, 1)
            PostMessage(DlgHnd, %DLG_MESS, %LB_GETSEL, 0)
      
          CASE %WM_NCACTIVATE
            STATIC hWndSaveFocus AS DWORD
            IF ISFALSE CBWPARAM THEN
              ' Save control focus
              hWndSaveFocus = GetFocus()
            ELSEIF hWndSaveFocus THEN
              ' Restore control focus
              SetFocus(hWndSaveFocus)
              hWndSaveFocus = 0
            END IF
      
          CASE %WM_COMMAND
            CtlMess = CBCTLMSG
            ' Process control notifications
            SELECT CASE AS LONG CtlHnd
              CASE %LBX_Relations
                IF CtlMess = %LBN_SELCHANGE OR CtlMess = %LBN_DBLCLK THEN
                  GRAPHIC CLEAR
                  GRAPHIC GET CLIENT TO X, Y
                  Rad! = 4 * ATN(1)
                  Rad! = Rad! / 180
                  Radius = 25
                  Cx! = X \ 2
                  Cy! = Y \ 2
                  Lx! = Cx!
                  Ly! = Cy! - Radius
                  
                  GRAPHIC SET POS(Lx!, Ly!)
      
                  FOR K = 0 TO 360 STEP 15
                    XX! = Cx! + Radius * SIN(K * Rad!)
                    YY! = Cy! - Radius * COS(K * Rad!)
                    GRAPHIC LINE (Lx!, Ly!) - (XX!, YY!), %RED
                    Lx! = XX!
                    Ly! = YY!
                  NEXT K
                  GRAPHIC PAINT (Cx!, Cy!), %RED, %RED
                END IF
              CASE %GFX_Relations
      
            END SELECT
          CASE %DlG_MESS
            IF Wparam = %LB_SETSEL THEN LISTBOX SELECT DlgHnd, %LBX_Relations, Lparam
            IF Wparam = %LB_GETSEL THEN
              Wparam = MAK(DWORD, %LBX_Relations, %LBN_DBLCLK)
              CONTROL HANDLE DlgHnd, %LBX_Relations TO CtlHnd
              Lparam = MAK(DWORD, CtlHnd, 0)
              PostMessage(DlgHnd, %WM_COMMAND, Wparam, Lparam)
            END IF
      
        END SELECT
      END FUNCTION
      '------------------------------------------------------------------------------
      
      '------------------------------------------------------------------------------
      '   ** Sample Code **
      '------------------------------------------------------------------------------
      FUNCTION SampleListBox(BYVAL hDlg AS DWORD, BYVAL lID AS LONG, BYVAL lCount _
        AS LONG) AS LONG
        LOCAL i AS LONG
      
        FOR i = 1 TO lCount
          LISTBOX ADD hDlg, lID, USING$("Test Item #", i)
        NEXT i
      END FUNCTION
      '------------------------------------------------------------------------------
      
      '------------------------------------------------------------------------------
      '   ** Dialogs **
      '------------------------------------------------------------------------------
      FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt AS LONG
      
      #PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
        LOCAL hDlg  AS DWORD
      
        DIALOG NEW hParent, "Dialog1", 133, 70, 314, 180, %WS_POPUP OR %WS_BORDER _
          OR %WS_DLGFRAME OR %WS_CAPTION OR %WS_SYSMENU OR %WS_CLIPSIBLINGS OR _
          %WS_VISIBLE OR %DS_MODALFRAME OR %DS_3DLOOK OR %DS_NOFAILCREATE OR _
          %DS_SETFONT, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
          %WS_EX_RIGHTSCROLLBAR, TO hDlg
        CONTROL ADD LISTBOX, hDlg, %LBX_Relations, , 10, 5, 80, 160, %WS_CHILD OR _
          %WS_VISIBLE OR %WS_TABSTOP OR %WS_VSCROLL OR %LBS_NOTIFY, _
          %WS_EX_CLIENTEDGE OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
          %WS_EX_RIGHTSCROLLBAR
        CONTROL ADD GRAPHIC, hDlg, %GFX_Relations, "", 100, 5, 210, 160
      #PBFORMS END DIALOG
      
        SampleListBox  hDlg, %LBX_Relations, 30
      
        DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
      
      #PBFORMS BEGIN CLEANUP %IDD_DIALOG1
      #PBFORMS END CLEANUP
      
        FUNCTION = lRslt
      END FUNCTION
      '------------------------------------------------------------------------------
      Last edited by Walt Decker; 1 Apr 2009, 06:06 PM.
      Walt Decker

      Comment


      • #4
        From the docs
        All PowerBASIC graphical displays are persistent -- they will be automatically redrawn even if minimized or temporarily covered by another window.
        Is this what you mean?????
        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


        • #5
          No, Cliff.

          In PBWIN8, if GRAPHIC ATTACH ........ REDRAW was specified, the graphic was drawn to a buffer and would not be updated unless GRAPHIC REDRAW was specifically requested or the graphic control was covered by another window, the control was moved, or the dialog was moved. That made it possible for an app to have several threads performing graphic operations and the graphic would not be updated until GRAPHIC REDRAW was specified.

          In the above examples GRAPHIC ATTACH .... REDRAW is specified but GRAPHIC REDRAW is not. The graphic control is updated anyway.
          Walt Decker

          Comment


          • #6
            Walt,

            I get the same results from your short version code whether compiled with PBWin804, 90 or 901.
            I'm not sure the graphic is being 'updated' except for the first time through, when the code in the %WM_INITDIALOG case is processed.

            If I comment out all statements in %WM_INITDIALOG and move the GRAPHIC ATTACH.. statement to..
            Code:
                      IF CtlMess = %LBN_SELCHANGE OR CtlMess = %LBN_DBLCLK Then
                        GRAPHIC ATTACH DlgHnd, %GFX_Relations
            Then all works as expected - for all compilers - and if REDRAW is added to the statement, a corresponding GRAPHIC REDRAW is required before the Graphic is updated (and all compilers behave the same).
            Rgds, Dave

            Comment


            • #7
              Dave,

              Actually, it shouldn't matter where GRAPHIC ATTACH is specified. However, I found out why the behavior is as it is. I made the assumption that "posted" messages are placed at the end of the message que and processed after all other messages are processed. This is apparently not the case during setup. Therefore, I'll have to make some changes.

              Just goes to show that ASSUME makes "an *** out of me".
              Walt Decker

              Comment


              • #8
                ..I'll have to make some changes.
                You might want to try this?
                Code:
                    CASE %WM_INITDIALOG
                      ' Initialization handler
                      GRAPHIC ATTACH DlgHnd, %GFX_Relations, Redraw
                      DIALOG POST DlgHnd, %WM_USER + 1000, 0, 0
                 
                    CASE %WM_USER + 1000
                      LOCAL Msg As tagMsg                               ' this makes sure that WM_PAINT 
                      DO WHILE PeekMessage(Msg, 0, 0, 0, %PM_NOREMOVE)  ' at end of Dialog creation doesn't
                        Dialog DoEvents 1                               ' occur after drawing statements
                      LOOP                                              ' (which causes 'Graphic Redraw')
                 
                      PostMessage(DlgHnd, %DLG_MESS, %LB_SETSEL, 1)
                      PostMessage(DlgHnd, %DLG_MESS, %LB_GETSEL, 0)
                Rgds, Dave

                Comment


                • #9
                  An alternative to the suggestion in post #8
                  Code:
                      CASE %WM_INITDIALOG
                        ' Initialization handler
                        GRAPHIC ATTACH DlgHnd, %GFX_Relations, Redraw
                        DIALOG POST DlgHnd, %WM_USER + 1000, 0, 0
                   
                      CASE %WM_USER + 1000
                        DIALOG REDRAW CBHNDL                              ' this makes sure that WM_PAINT 
                                                                          ' at end of Dialog creation doesn't
                                                                          ' occur after drawing statements
                                                                          ' (which causes 'Graphic Redraw')
                   
                        PostMessage(DlgHnd, %DLG_MESS, %LB_SETSEL, 1)
                        PostMessage(DlgHnd, %DLG_MESS, %LB_GETSEL, 0)
                  That would be kind of analogous to the SDK form..
                  Code:
                    ShowWindow hWnd&, iCmdShow
                    UpdateWindow hWnd&
                  Rgds, Dave

                  Comment


                  • #10
                    Dave:

                    Thanks for the suggestions. In this particular case I don't really care when things are drawn, but in other apps I have it makes a difference.

                    I'll explore your suggestions along with others I've thought about.
                    Walt Decker

                    Comment

                    Working...
                    X