Page 1 of 1
Logo on MDI window.
Posted: Sat Jan 02, 2021 11:27 pm
by byron.hopp
I use to do this using the old Harbour compiler. But since I moved to Borland my program gets hung up when clicking on the menu.
Here is the old code I used in the main program just before the Activate Window:
@ 0,0 Bitmap oLogo File Mcs_AppPath() + "Images\EocwdLogo.bmp" of oWnd:oWndClient PIXEL NOBORDER
oWnd:CoorsUpdate()
oWnd:bPainted := {|| SetLogo( oLogo,oWnd )}
Here is the function that runs during the paint event.
Function SetLogo( oLogo,oWnd )
Local nX,nY
oWnd:CoorsUpdate()
oWnd:oWndClient:CoorsUpdate()
oLogo:CoorsUpdate()
oLogo:Hide()
nX := oWnd:oWndClient:nWidth() - oLogo:nWidth() - 10
nY := oWnd:oWndClient:nHeight() - oLogo:nHeight() - 10
oLogo:Move( nY,nX,oLogo:nWidth(), oLogo:nHeight(),.t. )
oLogo:Show()
return NIL
Re: Logo on MDI window.
Posted: Sun Jan 03, 2021 4:46 pm
by Antonio Linares
Byron,
I have modified your code and it is working fine with Borland and Microsoft:
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local oWnd, oLogo
DEFINE WINDOW oWnd MDI
@ 0, 0 Bitmap oLogo File "c:\fwh\bitmaps\fivetech.bmp" of oWnd:oWndClient PIXEL NOBORDER
oWnd:oWndClient:bPainted := { || SetLogo( oLogo,oWnd ), 1 }
oWnd:bResized := { || SetLogo( oLogo, oWnd ) }
ACTIVATE WINDOW oWnd
return nil
function SetLogo( oLogo, oWnd )
local nX, nY
nX := oWnd:oWndClient:nWidth() - oLogo:nWidth() - 10
nY := oWnd:oWndClient:nHeight() - oLogo:nHeight() - 10
oLogo:Move( nY, nX, oLogo:nWidth(), oLogo:nHeight(), .T. )
return nil
Re: Logo on MDI window.
Posted: Sun Jan 03, 2021 7:31 pm
by byron.hopp
Perfect...
Thank you,
Re: Logo on MDI window.
Posted: Sun Jan 03, 2021 7:52 pm
by nageswaragunupudi
May I suggest another alternative?
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local oWnd
DEFINE WINDOW oWnd MDI
oWnd:oWndClient:bPainted := ;
{ || oWnd:oWndClient:DrawImage( "c:\fwh\bitmaps\fivetech.bmp", ;
{ nil, nil, -10, -10 }, .f., nil, nil, nil, "BR" ) }
ACTIVATE WINDOW oWnd
return nil
Re: Logo on MDI window.
Posted: Sun Jan 03, 2021 8:34 pm
by Antonio Linares
The shortest, the nicest
Thank you Rao
Re: Logo on MDI window.
Posted: Wed Nov 09, 2022 12:28 pm
by Silvio.Falconi
Antonio Linares wrote:The shortest, the nicest
Thank you Rao
Antonio, a question
I have this Main window and I put the image as you can see but I have a Bar at right,
when I hide the bar the oWinMain:oWndClient not bpainted
and when I reopen the bar right I must redraw the image
how I can resolve it ?
I add
oApp:oWinMain:bResized := { || SetLogo( oApp:oLogo, oApp:oWinMain )
and the procedure make error when I resize
Error description: Error BASE/1004 Metodo non disponibile: NWIDTH
Args:
[ 1] = C c:\work\fwh\bitmaps\fivetech.bmp
Stack Calls
===========
Called from: => NWIDTH( 0 )
Called from: Source\ut\ut_boxlotto.prg => SETLOGO( 200 )
Re: Logo on MDI window.
Posted: Wed Nov 09, 2022 6:06 pm
by Antonio Linares
Dear Silvio,
I would say that you have not properly created oLogo as it is containing a string instead of an object
Re: Logo on MDI window.
Posted: Thu Nov 10, 2022 8:57 am
by Silvio.Falconi
Antonio Linares wrote:Dear Silvio,
I would say that you have not properly created oLogo as it is containing a string instead of an object
I copied only your test and I add only a buttonbar ( oBarRight) and another Buttonbar (oBar)
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local oWnd, oLogo, oBarRight,oBar,oFont
local nClrText := CLR_BLACK
DEFINE FONT oFont NAME "TAHOMA" SIZE 0, 14
DEFINE WINDOW oWnd MDI ;
COLOR CLR_BLACK, CLR_WHITE
@ 0, 0 Bitmap oLogo File "c:\work\fwh\bitmaps\fivetech.bmp" of oWnd:oWndClient PIXEL NOBORDER
DEFINE BUTTONBAR oBar OF oWnd _3D 2015 //SIZE 40, 40
DEFINE BUTTON FILENAME "chiudi.bmp" OF oBar NOBORDER GROUP ;
ACTION ( oBarRight:show(), oWnd:bResized := { || SetLogo( oLogo, oWnd ) })
oWnd:oWndClient:bPainted := { || SetLogo( oLogo,oWnd ), 1 }
oWnd:bResized := { || SetLogo( oLogo, oWnd ) }
DEFINE BUTTONBAR oBarRight OF oWnd SIZE 230,32 2013 RIGHT
Navigator(oBarRight,oWnd,oLogo)
oWnd:oRight:= oBarRight
ACTIVATE WINDOW oWnd
return nil
function SetLogo( oLogo, oWnd )
local nX, nY
nX := oWnd:oWndClient:nWidth() - oLogo:nWidth() - 10
nY := oWnd:oWndClient:nHeight() - oLogo:nHeight() - 10
oLogo:Move( nY, nX, oLogo:nWidth(), oLogo:nHeight(), .T. )
return nil
Function Navigator(oBarRight,oWnd,oLogo)
local oPanel1
DEFINE BUTTON FILENAME "apri.bmp" OF oBarRight NOBORDER GROUP ;
ACTION CloseBarra(oWnd,oBarRight,oLogo)
Return nil
Function CloseBarra(oWnd,oBarRight,oLogo)
oBarRight:Hide()
UpdateWindow( oWnd:hWnd )
oWnd:CoorsUpdate()
SysRefresh()
oWnd:bResized := { || SetLogo( oLogo, oWnd ) }
return nil
I understood that even if I hide the oBarRight object in reality the object is still there so oLogo is not placed in the right corner
so how should i do?
I tried with Destroy () but it still persists
Re: Logo on MDI window.
Posted: Thu Nov 10, 2022 11:41 am
by Antonio Linares
Dear Silvio,
Code: Select all | Expand
Function CloseBarra(oWnd,oBarRight,oLogo)
oBarRight:Hide()
oWnd:oRight:= nil
oWnd:Resize()
UpdateWindow( oWnd:hWnd )
oWnd:CoorsUpdate()
SysRefresh()
oWnd:bResized := { || SetLogo( oLogo, oWnd ) }
return nil
Re: Logo on MDI window.
Posted: Thu Nov 10, 2022 12:20 pm
by Silvio.Falconi
Antonio Linares wrote:Dear Silvio,
Code: Select all | Expand
Function CloseBarra(oWnd,oBarRight,oLogo)
oBarRight:Hide()
oWnd:oRight:= nil
oWnd:Resize()
UpdateWindow( oWnd:hWnd )
oWnd:CoorsUpdate()
SysRefresh()
oWnd:bResized := { || SetLogo( oLogo, oWnd ) }
return nil
yes, I 'm making the same corrections!!!
only I have the wnd child under the obarright also
and I must press two
Code: Select all | Expand
#include "FiveWin.ch"
#define colore1 nRgb( 245,244,234) //sfondo dialog
#define colore2 nRgb(233,229,206)
function Main()
local oWnd, oLogo, oBarRight,oBar,oFont
local nClrText := CLR_BLACK
DEFINE FONT oFont NAME "TAHOMA" SIZE 0, 14
DEFINE WINDOW oWnd MDI ;
COLOR CLR_BLACK, CLR_WHITE ;
TITLE "Test logo in Mdi with two buttonars"
@ 0, 0 Bitmap oLogo File "c:\work\fwh\bitmaps\fivetech.bmp" of oWnd:oWndClient PIXEL NOBORDER
DEFINE BUTTONBAR oBar OF oWnd _3D 2015 //SIZE 40, 40
DEFINE BUTTON FILENAME "chiudi.bmp" OF oBar NOBORDER GROUP ;
ACTION MostraBarra(oBarRight,oWnd)
DEFINE BUTTONBAR oBarRight OF oWnd SIZE 230,32 2013 RIGHT
oBarRight:bClrGrad := { | lPressed | If( ! lPressed,;
{ { 0.5, colore2,colore2 } },;
{ { 0.5, colore1, colore1 } } ) }
oWnd:oWndClient:bPainted := { || SetLogo( oLogo,oWnd ), 1 }
oWnd:bResized := { || SetLogo( oLogo, oWnd ) }
Navigator(oBarRight,oWnd,oLogo)
oWnd:oRight:= oBarRight
ACTIVATE WINDOW oWnd
return nil
function SetLogo( oLogo, oWnd )
local nX, nY
nX := oWnd:oWndClient:nWidth() - oLogo:nWidth() - 10
nY := oWnd:oWndClient:nHeight() - oLogo:nHeight() - 10
oLogo:Move( nY, nX, oLogo:nWidth(), oLogo:nHeight(), .T. )
return nil
Function Navigator(oBarRight,oWnd,oLogo)
local oPanel1
DEFINE BUTTON FILENAME "apri.bmp" OF oBarRight NOBORDER GROUP ;
ACTION CloseBarra(oWnd,oBarRight)
Return nil
Function MostraBarra(oBarRight,oWnd)
UpdateWindow( oWnd:hWnd )
oWnd:CoorsUpdate()
oWnd:oRight:=oBarRight
oWnd:resize()
oBarRight:nWidth:= 250
oBarRight:show()
SysRefresh()
return nil
Function CloseBarra(oWnd,oBarRight)
oBarRight:Hide()
oBarRight:nWidth:=1
oWnd:oRight:=NIL
oWnd:resize()
SysRefresh()
Return nil
the child window gets under the bar but it should go all the way to the bar, also when I restore the bar I have to press the button twice to make the bar appear again.
Re: Logo on MDI window.
Posted: Thu Nov 10, 2022 12:22 pm
by Silvio.Falconi
Now run ok
the child window gets under the bar
how can i tell that the windows child must go before the bar?
try this release
Code: Select all | Expand
#include "FiveWin.ch"
#define colore1 nRgb( 245,244,234) //sfondo dialog
#define colore2 nRgb(233,229,206)
function Main()
local oWnd, oLogo, oBarRight,oBar,oFont
local nClrText := CLR_BLACK
DEFINE FONT oFont NAME "TAHOMA" SIZE 0, 14
DEFINE WINDOW oWnd MDI ;
COLOR CLR_BLACK, CLR_WHITE ;
TITLE "Test logo in Mdi with two buttonars"
@ 0, 0 Bitmap oLogo File "c:\work\fwh\bitmaps\fivetech.bmp" of oWnd:oWndClient PIXEL NOBORDER
DEFINE BUTTONBAR oBar OF oWnd _3D 2015 //SIZE 40, 40
DEFINE BUTTON FILENAME "chiudi.bmp" OF oBar NOBORDER GROUP ;
ACTION MostraBarra(oBarRight,oWnd)
DEFINE BUTTON OF oBar NOBORDER GROUP ;
ACTION Newchild(oWnd)
DEFINE BUTTONBAR oBarRight OF oWnd SIZE 230,32 2013 RIGHT
oBarRight:bClrGrad := { | lPressed | If( ! lPressed,;
{ { 0.5, colore2,colore2 } },;
{ { 0.5, colore1, colore1 } } ) }
oWnd:oWndClient:bPainted := { || SetLogo( oLogo,oWnd ), 1 }
oWnd:bResized := { || SetLogo( oLogo, oWnd ) }
Navigator(oBarRight,oWnd,oLogo)
oWnd:oRight:= oBarRight
ACTIVATE WINDOW oWnd
return nil
function SetLogo( oLogo, oWnd )
local nX, nY
nX := oWnd:oWndClient:nWidth() - oLogo:nWidth() - 10
nY := oWnd:oWndClient:nHeight() - oLogo:nHeight() - 10
oLogo:Move( nY, nX, oLogo:nWidth(), oLogo:nHeight(), .T. )
return nil
Function Navigator(oBarRight,oWnd,oLogo)
local oPanel1
DEFINE BUTTON FILENAME "apri.bmp" OF oBarRight NOBORDER GROUP ;
ACTION CloseBarra(oWnd,oBarRight)
Return nil
Function MostraBarra(oBarRight,oWnd)
oBarRight:nWidth:= 250
oBarRight:show()
UpdateWindow( oWnd:hWnd )
oWnd:CoorsUpdate()
oWnd:oRight:=oBarRight
oWnd:resize()
SysRefresh()
return nil
Function CloseBarra(oWnd,oBarRight)
oBarRight:Hide()
oBarRight:nWidth:=1
oWnd:oRight:=NIL
oWnd:resize()
SysRefresh()
Return nil
Function Newchild(oWnd)
local oWinNew
local nRow:= 0,nCol:= 0
local nHChild := 24
local nWChild := 80
local nPosL := 0
local nPosVSp := 360 //331
local nHSay := 19
local nWPanel := 32
if Len( oWnd:oWndClient:aWnd ) > 0
if ( nRow + nHChild ) > oWnd:nHeight
nRow := 0
if ( nCol + Int( nWChild / 2 ) ) > oWnd:nWidth
nCol := 0
else
nCol += Int( nWChild / 2 )
endif
else
nRow += Int( nHChild / 4 )
endif
endif
if oWinNew == nil
DEFINE WINDOW oWinNew MDICHILD ;
FROM nRow, nCol TO nHChild, nWChild ;
TITLE "test new child " ;
of oWnd
ACTIVATE WINDOW oWinNew
else
oWinNew:SetFocus()
endif
RETURN NIL
that is, I have to impose on the child window that if there is a bar it must not go beyond that column, if it is not there it can go to the end of the main window