Logo on MDI window.

Logo on MDI window.

Postby byron.hopp » Sat Jan 02, 2021 11:27 pm

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
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Logo on MDI window.

Postby Antonio Linares » Sun Jan 03, 2021 4:46 pm

Byron,

I have modified your code and it is working fine with Borland and Microsoft:

Code: Select all  Expand view  RUN
#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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Logo on MDI window.

Postby byron.hopp » Sun Jan 03, 2021 7:31 pm

Perfect...

Thank you,
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Logo on MDI window.

Postby nageswaragunupudi » Sun Jan 03, 2021 7:52 pm

May I suggest another alternative?
Code: Select all  Expand view  RUN
#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
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Logo on MDI window.

Postby Antonio Linares » Sun Jan 03, 2021 8:34 pm

The shortest, the nicest :-)

Thank you Rao
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Logo on MDI window.

Postby Silvio.Falconi » Wed Nov 09, 2022 12:28 pm

Antonio Linares wrote:The shortest, the nicest :-)

Thank you Rao



Antonio, a question

Image


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
User avatar
Silvio.Falconi
 
Posts: 7072
Joined: Thu Oct 18, 2012 7:17 pm

Re: Logo on MDI window.

Postby Antonio Linares » Wed Nov 09, 2022 6:06 pm

Dear Silvio,

I would say that you have not properly created oLogo as it is containing a string instead of an object
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Logo on MDI window.

Postby Silvio.Falconi » Thu Nov 10, 2022 8:57 am

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)



Image



Code: Select all  Expand view  RUN


#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
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
User avatar
Silvio.Falconi
 
Posts: 7072
Joined: Thu Oct 18, 2012 7:17 pm

Re: Logo on MDI window.

Postby Antonio Linares » Thu Nov 10, 2022 11:41 am

Dear Silvio,

Code: Select all  Expand view  RUN
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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Logo on MDI window.

Postby Silvio.Falconi » Thu Nov 10, 2022 12:20 pm

Antonio Linares wrote:Dear Silvio,

Code: Select all  Expand view  RUN
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 view  RUN
#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.
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
User avatar
Silvio.Falconi
 
Posts: 7072
Joined: Thu Oct 18, 2012 7:17 pm

Re: Logo on MDI window.

Postby Silvio.Falconi » Thu Nov 10, 2022 12:22 pm

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 view  RUN
#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
User avatar
Silvio.Falconi
 
Posts: 7072
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 51 guests