Logo on MDI window.
-
- Posts: 388
- Joined: Sun Nov 06, 2005 3:55 pm
- Location: Southern California, USA
- Contact:
Logo on MDI window.
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
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
Thanks,
Byron Hopp
Matrix Computer Services
Byron Hopp
Matrix Computer Services
- Antonio Linares
- Site Admin
- Posts: 42393
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 9 times
- Been thanked: 41 times
- Contact:
Re: Logo on MDI window.
Byron,
I have modified your code and it is working fine with Borland and Microsoft:
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
-
- Posts: 388
- Joined: Sun Nov 06, 2005 3:55 pm
- Location: Southern California, USA
- Contact:
- nageswaragunupudi
- Posts: 10701
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 3 times
- Contact:
Re: Logo on MDI window.
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
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Antonio Linares
- Site Admin
- Posts: 42393
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 9 times
- Been thanked: 41 times
- Contact:
- Silvio.Falconi
- Posts: 7110
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Logo on MDI window.
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 )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- Antonio Linares
- Site Admin
- Posts: 42393
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 9 times
- Been thanked: 41 times
- Contact:
Re: Logo on MDI window.
Dear Silvio,
I would say that you have not properly created oLogo as it is containing a string instead of an object
I would say that you have not properly created oLogo as it is containing a string instead of an object
- Silvio.Falconi
- Posts: 7110
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Logo on MDI window.
I copied only your test and I add only a buttonbar ( oBarRight) and another Buttonbar (oBar)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
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
so how should i do?
I tried with Destroy () but it still persists
Last edited by Silvio.Falconi on Thu Nov 10, 2022 12:06 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- Antonio Linares
- Site Admin
- Posts: 42393
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 9 times
- Been thanked: 41 times
- Contact:
Re: Logo on MDI window.
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
- Silvio.Falconi
- Posts: 7110
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Logo on MDI window.
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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- Silvio.Falconi
- Posts: 7110
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Logo on MDI window.
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
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
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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com