Buttons under a new window

This forum is for eXpress++ general support.
Message
Author
Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Buttons under a new window

#1 Post by Andy Edward »

Hi all,

I have a screen like so:
Untitled-1.gif
Untitled-1.gif (32.26 KiB) Viewed 12450 times
When I click one of the buttons, I will open up a new window. But when I drag the new window, the buttons below which are on the path of my dragging movement disappear. Even the static that says 'Favorite Shortcuts' also gone.
Untitled-2.gif
Untitled-2.gif (46.64 KiB) Viewed 12450 times
Can someone enlighten me to why it's behaving this way?

Andy

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: Buttons under a new window

#2 Post by Andy Edward »

continuing from the questions above (can only attach 3 attachments per post)

if I move the window to almost where the buttons are,
Untitled-3.gif
Untitled-3.gif (48.24 KiB) Viewed 12450 times

and close the window. The buttons are cut.
Untitled-4.gif
Untitled-4.gif (34.96 KiB) Viewed 12450 times
Any ideas?

Wolfgang Ciriack
Posts: 478
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Buttons under a new window

#3 Post by Wolfgang Ciriack »

Try to put all your groups on a static, i think the static will be repaint after the dialog is closed.
_______________________
Best Regards
Wolfgang

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: Buttons under a new window

#4 Post by Andy Edward »

Hi Wolfgang,

The blue bordered boxes are actually already STATICS which I took the sample from /Samples/Static/FormBox.prg

I didn't create the blue bordered boxes using DCGROUP. Should I have done that?

Regards,

Andy

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Buttons under a new window

#5 Post by rdonnay »

I need to see your code.

I believe that your buttons are siblings of the static rather than children.
This would cause the problem you are seeing.
The eXpress train is coming - and it has more cars.

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: Buttons under a new window

#6 Post by Andy Edward »

I can't paste the full code because of a lot of data driven stuff, so I'll just give the flow of the code

I'll just paste the code for the top right side of the screen:

Code: Select all

// TOP PART OF RIGHT SIDE 
@ 10,nSidebarWidth+15.7  DCSTATIC TYPE XBPSTATIC_TYPE_TEXT;
        SIZE nWIDTH-nSidebarWidth, (nHEIGHT/2)  PIXEL;
        OBJECT oRightStaticTitle;
        COLOR nil,COLOR_WHITE;

Code: Select all

// BLUE BORDERED BOX CALLED FAVORITE SHORTCUTS
@ 12,10 TO nHEIGHT/2 - 10,nWIDTH - (nSidebarWidth+17.7) FORM_BOX HEADER 'FAVORITE SHORTCUTS';
           TEXTOBJ oText1Static ;
           HEADFONT '8.SEGOE UI Bold' ;
           BOXCOLOR COLOR_BUTTONS_BG, COLOR_WHITE;
           HEADCOLOR COLOR_BLACK, COLOR_BUTTONS_BG ;
           PARENT oRightStaticTitle

Code: Select all

//THIS IS WHERE WE DISPLAY THE BUTTONS INSIDE THE BLUE BORDERED BOX
DO WHILE .NOT. EOF()
@ npos1 , npos2 DCPUSHBUTTONXP SIZE 100,100 PIXEL ;
                     ACTION bActionBlock ;
                     CAPTIONARRAY aCaptions ;
                     PARENT oText1Static ;
                     TOOLTIP cCaption ;
                     CARGO cId ;
                     EVAL bEval ;
                     CONFIG configArray 

ENDDO
I won't paste the code for the bottom 3 columns as it is pretty much the same code flow, just with different sizes.

Code: Select all

// THIS IS THE DCREAD
DCREAD GUI OPTIONS GETOPTIONS TO EXIT_ALL TITLE M_TITLE PARENT @oDlg;
         TIMEOUT {M3600,{|| xQUIT() } };  && QUIT IF NOT USE FOR 1 HOUR
         EVAL {|| SetAppWindow(oDlg),oDlg:setframestate(2),saveSidebar(oStatic3)}
         SetAppWindow(oApp)
Is the relation correct?

After a bit of investigating, I notice that windows NOT created with MODAL option have this problem. We can't make every windows MODAL because of business requirements.

Regards,

Andy

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Buttons under a new window

#7 Post by rdonnay »

I need to see your FORM_BOX command.

I think the issue may be the TEXTOBJ clause.

This may not be actually creating a proper pointer to the object, which would cause the buttons to be children of the dialog drawingArea rather than the FORM_BOX.

To insure that this is correct you can use the DC_ArrayView() function. It will show you the children of oText1Static.

Do this:

DCREAD GUI EVAL {||DC_ArrayView( oText1Static )}

This should show you the child list. You should see a lot of DC_XbpPushButtonXP() objects.
The eXpress train is coming - and it has more cars.

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: Buttons under a new window

#8 Post by Andy Edward »

Hi Roger,

Code: Select all

/* CUSTOM BOX */
#xtranslate  @ <nSRow>,<nSCol> TO <nERow>,<nECol> ;
          FORM_BOX [HEADER <cHeader>] ;
                   [TEXT <cText>] ;
                   [HEADALIGN <nHdAlign>] ;
                   [HEADHEIGHT <nHdHeight>] ;
                   [HEADFONT <nHdFont>] ;
                   [HEADCOLOR <ncHdFgC> [,<ncHdBgC>]] ;
                   [HEADOBJ <oHdObj>] ;
                   [TEXTALIGN <nTxAlign>] ;
                   [TEXTFONT <nTxFont>] ;
                   [TEXTCOLOR <ncTxFgC> [,<ncTxBgC>]] ;
                   [TEXTOBJ <oTxObj>] ;
                   [BOXCOLOR <ncBxFgC> [,<ncBxBgC>]] ;
                   [HRADIUS <nHRadius>] ;
                   [VRADIUS <nVRadius>] ;
                   [PARENT <oParent>] ;
                   [OBJECT <oObject>]
          => ;
          Form_box( [<cHeader>], ;
                   [<cText>], ;
                   [<nSRow>], [<nSCol>], [<nERow>], [<nECol>], ;
                   [<nHdAlign>], ;
                   [<nHdHeight>], ;
                   [<nHdFont>], ;
                   [<ncHdFgC>], ;
                   [<ncHdBgC>], ;
                   [@<oHdObj>], ;
                   [<nTxAlign>], ;
                   [<nTxFont>], ;
                   [<ncTxFgC>], ;
                   [<ncTxBgC>], ;
                   [@<oTxObj>], ;
                   [<ncBxFgC>], ;
                   [<ncBxBgC>], ;
                   [<nHRadius>], ;
                   [<nVRadius>], ;
                   [@<oParent>], ;
                   GetList,;
                   .T., ;
                   .T. )

Code: Select all

* ------------

FUNCTION Form_Box(cHeader, cText, nSRow, nSCol, nERow, nECol, nHeadAlign, nHeadHeight, nHeadFont, ;
                  ncHdFgC, ncHdBgC, oHeadObj, nTextAlign, nTextFont, ncTxFgC, ncTxBgC, oTextObj, ;
                  ncBxFgC, ncBxBgC, nHRadius, nVRadius,  oParent, GetList, lHeader, lBox )

LOCAL i, nRow := 0, aStatic[20], nOffSet, nTxRow, nHdRow, nHdCol

DEFAULT nHeadAlign := XBPSTATIC_TEXT_VCENTER + XBPSTATIC_TEXT_CENTER,;
        nTextAlign := XBPSTATIC_TEXT_VCENTER + XBPSTATIC_TEXT_CENTER,;
        nHeadHeight := 20,;
        nHeadFont := '9.Arial',;
        nTextFont := '9.Arial Bold',;
        ncHdFgC := GRA_CLR_WHITE,;
        ncHdBgC := GRA_CLR_PALEGRAY,;
        ncTxFgC := GRA_CLR_BLACK,;
        ncTxBgC := XBPSYSCLR_TRANSPARENT,;
        ncBxFgC := GRA_CLR_PALEGRAY,;
        ncBxBgC := GRA_CLR_WHITE,;
        nHRadius := 30,;
        nVRadius := 30,;
        lHeader := .T.,;
        lBox := .T.,;
        nOffSet := IIF( lHeader, 3, 0 )

IF lBox

  nTxRow := IIF( lHeader, (nHeadHeight*16)+nOffSet, 3 )

  @  nSRow, nSCol DCSTATIC SIZE nECol - nSCol, nERow - nSRow PIXEL;
                  SUBCLASS 'CustomStatic()' ;
                  PARENT oParent ;
                  COLOR ncBxFgC, ncBxBgC OBJECT oTextObj ;
                  PREEVAL {|o|o:radiusH := nHRadius, ;
                           o:radiusV := nVRadius, ;
                           o:isOutline := .t., ;
                           o:outlineWidth := 5 } ;
                  DROP {|o,a,b|DropIcon(o,a,b)}         

  @   nTxRow, 3.00 DCSAY cText PARENT oTextObj ;
                   SIZE DCGUI_PARENTWIDTH-10 PIXEL ;
                   SAYOPTION nTextAlign FONT nTextFont ;
                   COLOR ncTxFgC, nctxBgC
ENDIF


IF lHeader
  nHdRow := IIF( lBox, 0, nSRow )
  nHdCol := IIF( lBox, 0, nSCol )
  nHeadHeight := IIF( lBox, nHeadHeight, nERow - nSRow )

  @ nHdRow,nHdCol DCSTATIC SIZE nECol - nSCol, nHeadHeight PIXEL ;
                  SUBCLASS 'CustomStatic()' ;
                  PARENT oTextObj ;
                  COLOR ncHdFgC, ncHdBgC OBJECT oHeadObj ;
                  PREEVAL {|o|o:radiusH := nHRadius, ;
                              o:radiusV := nVRadius, ;
                              o:isOutline := .f., ;
                              o:isHeader := .t.} ;
                  RESIZE DCGUI_RESIZE_REPOSY_RESIZEX

  @   2.00,  8.00 DCSAY cHeader PARENT oHeadObj ;
                  SIZE DCGUI_PARENTWIDTH-16, DCGUI_PARENTHEIGHT-4 PIXEL ;
                  SAYOPTION nHeadAlign FONT nHeadFont ;
                  COLOR ncHdFgC, ncHdBgC
ENDIF


RETURN nil

Code: Select all

*--------------------------------------
CLASS CustomStatic FROM DC_XbpStatic

EXPORTED:

VAR radiusH
VAR radiusV
VAR colorBG
VAR colorFG
VAR caption
VAR isOutline
VAR outlineWidth
VAR isHeader

* ----------

INLINE METHOD Init(a,b,c,d,e,f,g,h)

LOCAL aGetList, aGetListItem

::DC_XbpStatic:init(a,b,c,d,e,f,g,h)

aGetList := ::getList:getListArray
aGetListItem := ::getList:getListArray[::getListPointer]

::drawMode := XBP_DRAW_OWNER

::colorFG := aGetListItem[aGETLIST_COLOR][2]
::colorBG := aGetListItem[aGETLIST_COLOR][1]
::caption := aGetListItem[cGETLIST_CAPTION]

DEFAULT ::radiusH := 10,;
        ::radiusH := 10,;
        ::isOutline := .f.,;
        ::outlineWidth := 5, ;
        ::isHeader := .f.

RETURN self

* ----------

INLINE METHOD Create(a,b,c,d,e,f,g,h)

::DC_XbpStatic:create(a,b,c,d,e,f,g,h)

return self
* -----------

INLINE METHOD Draw( oPS, aInfo )

LOCAL aStartPos := {aInfo[4][1],aInfo[4][2]}
LOCAL aEndPos   := {aInfo[4][3],aInfo[4][4]}
LOCAL aAttrArea := Array(GRA_AA_COUNT)
LOCAL aAttrLine := Array(GRA_AL_COUNT)
LOCAL nColor

IF !::isHeader
  nColor := ::parent:setColorBG()
  IF nColor == NIL
    IF IsMethod(::parent:setParent(),'SETCOLORBG')
      nColor := ::parent:setParent():setColorBG()
    ENDIF
  ENDIF
  GraSetColor( oPS, nColor, nColor )
  GraBox( oPS, aStartPos, aEndPos, GRA_FILL )
ENDIF

GraSetColor( oPS, ::colorFG, ::colorBG )
GraBox( oPS, aStartPos, aEndPos, GRA_FILL, ::radiusH, ::radiusV)

IF ::isOutline
  aAttrLine[GRA_AL_WIDTH] := ::outlineWidth
  GraSetAttrLine( oPS, aAttrLine )
  GraSetColor( oPS, ::colorBG, ::colorFG )
  GraBox( oPS, aStartPos, aEndPos, GRA_OUTLINE, ::radiusH, ::radiusV)
ENDIF

GraSetColor( oPS, ::colorBG )
GraStringAt( oPS, {10,10}, ::caption )

RETURN self

ENDCLASS

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Buttons under a new window

#9 Post by rdonnay »

I don't see anything obviously wrong with the code.

Maybe I don't really understand the problem.

What time zone are you in?

If you have a Skype account, we can connect via Skype and I can visually see what is happening.
The eXpress train is coming - and it has more cars.

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: Buttons under a new window

#10 Post by Andy Edward »

HI Roger,

My Timezone is GMT+8. it's 10:45 AM here. I'll pm you my Skype contact

Best Regards,

Andy

Post Reply