FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour A problem with < BringWindowToTop >
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
A problem with < BringWindowToTop >
Posted: Mon Oct 23, 2017 06:18 PM
Hello,

To define a area, I want to keep the SAY visible on top in DESIGN-mode
but < BringWindowToTop > doesn't help.
Moving the SAY, it is shown behind all other objects.



I can crop anything from the dialog with resize and image-format-export



a right mouseclick inside the dialog creates a transparent SAY in DESIGN-mode

A short test without image ( NO extras needed )
Right mouseclick. Next move the say to the browser-area.

Code (fw): Select all Collapse
#include "fivewin.ch"
#include "xbrowse.ch"

STATIC oDlg, nClicked := 0, oCSay 
STATIC oFont1, oFont2 

FUNCTION MAIN()
LOCAL oBrw, aArray := {}, oGet, cGet := "    ", oSay1

DEFINE FONT oFont1  NAME "Tahoma" SIZE 0, -16 BOLD
DEFINE FONT oFont2  NAME "Tahoma" SIZE 0, -12 BOLD

IF EMPTY( aArray )
    aArray := {{"one","two","three","four"},;
        {"one","two","three","four"},;
        {"one","two","three","four"},;
        {"one","two","three","four"}}
ENDIF

DEFINE DIALOG oDlg TITLE "Crop-Sample"  SIZE 700, 600 TRUEPIXEL

@ 50, 50 XBROWSE oBrw SIZE 320, 200 OF oDlg ;
COLUMNS {1,2,3,4} ;
HEADERS {"Btn Trans - 1","Btn Trans - 2","Header - 3","Header - 4"} ;
ARRAY aArray LINES CELL  PIXEL 
oBrw:nRowHeight := 25

oBrw:bClrStd := {|| {CLR_BLACK, CLR_CYAN } }

oBrw:CREATEFROMCODE()

@ 300, 100 SAY "Text..:" SIZE 100, 20 OF oDlg COLOR 0, 255 FONT oFont2 PIXEL
@ 300, 250 GET oGet VAR cGET OF oDlg SIZE 100, 20 COLOR "W/G" PICTURE "@K" PIXEL

oDlg:bRClicked := {| nRow, nCol | nClicked++, IIF( nClicked = 1, ;
                          MAKE_AREA( nRow, nCol ), MSG_AREA() ) }

ACTIVATE DIALOG oDlg 

oFont1:End()
oFont2:End()

RETURN NIL

//---------------------------- 

FUNCTION MAKE_AREA( nRow, nCol ) 

//New( nRow, nCol, bText, oWnd, cPicture, oFont,;
//               lCentered, lRight, lBorder, lPixels, nClrText, nClrBack,;
//               nWidth, nHeight, lDesign, lUpdate, lShaded, lBox, lRaised,;
//               lAdjust, cVarName, lUnicode, lVCenter ) CONSTRUCTOR

oCSay := TSAY():New( nRow, nCol, NIL, oDlg, NIL, NIL,;
               NIL, NIL, .T., .T., NIL, NIL,;
               150, 150, .T., .T., .T. ) 

oCSay:lTransparent := .T.
oCSay:bGet := nil
oCSay:lWantClick := .T.
BringWindowToTop( oCSay:hWnd ) 
oCSay:SetFocus()

RETURN( NIL )

//------------------------------ 

FUNCTION MSG_AREA()

aRect := GETCLIENTRECT( oCSay:hWnd )
nTop :=  oCSay:nTop
nLeft := oCSay:nLeft
nBottom := aRect[3]
nRight := aRect[4]

oCSay:SetFocus()

MsgAlert( "Top : " + STR(nTop) + CRLF + "Left : " + STR(nLeft) + CRLF + "Height : " + ;
           STR(nBottom) + CRLF + "Width : " + STR(nRight), "Selected area" )

RETURN NIL


any idea ?

regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: A problem with &lt; BringWindowToTop &gt;
Posted: Tue Oct 24, 2017 08:05 AM

Uwe,

Your code is quite similar to FWH\samples\design.prg and design.prg does it right...

I have been testing your example and can't understand why BringWindowToTop() is not working there

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: A problem with &lt; BringWindowToTop &gt;
Posted: Tue Oct 24, 2017 10:21 AM
Antonio,

I only added some controls ( browser, say and get )to the original sample FWH\samples\design.prg
The only control that stays on top in DESIGN-mode is the listbox ( but only getting the focus ).
Loosing the focus, it is covered as well.





Code (fw): Select all Collapse
// Dialogs designer

#include "FiveWin.ch"
#include "xBrowse.ch"

static oDlg, lDesign := .T.

//----------------------------------------------------------------//

function Main()
local oBrw, aArray := {}, oGet, cGET := "Test"

IF EMPTY( aArray )
    aArray := {{"one","two","three"},;
        {"one","two","three"},;
        {"one","two","three"},;
        {"one","two","three"}}
ENDIF

   DEFINE DIALOG oDlg TITLE "Dialog designer" SIZE 500, 300 ;
      STYLE nOr( WS_THICKFRAME, WS_SYSMENU )

   oDlg:cVarName = "oDlg"

@ 20, 180 SAY "Text..:" SIZE 50, 12 OF oDlg COLOR 0, 255  PIXEL
@ 50, 180 GET oGet VAR cGET OF oDlg SIZE 50, 12 COLOR "W/G" PICTURE "@K" PIXEL

@ 20, 20 XBROWSE oBrw SIZE 130, 70 OF oDlg ;
COLUMNS {1,2,3,4} ;
HEADERS {"Btn Trans - 1","Btn Trans - 2","Header - 3"} ;
ARRAY aArray LINES CELL PIXEL  
oBrw:nRowHeight := 25

oBrw:bClrStd := {|| {CLR_BLACK, CLR_CYAN } }

oBrw:CREATEFROMCODE()

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT  ( /* oDlg:nOpacity := 150,*/  PlaceControl( oDlg ) ) ;
      ON PAINT If( lDesign, DrawGrid( oDlg:hWnd, hDC, cPS, 8, 8 ),) ;
      ON RIGHT CLICK EditDialog( nRow, nCol, oDlg )

return nil


regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion