FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour MENU paint Issue *Fixed*
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
MENU paint Issue *Fixed*
Posted: Tue Aug 07, 2018 12:11 AM
I use menu in Main Function as sample below.
Code (fw): Select all Collapse
*------------------*
Function BuildMenu()
Local cClrSelIni, cClrSelFin, cClrSelTxt, cClrSelBor
Local cClrMenu, cClrMenuTxt

cClrMenu    := nRGB( 26, 124, 249 ) 
cClrMenuTxt := CLR_BLUE    
cClrSelIni  := nRGB( 250, 250, 250)
cClrSelFin  := nRGB( 250, 250, 250) 
cClrSelTxt  := nRGB( 10, 10, 10 ) 
cClrSelBor  := CLR_WHITE 

// GetnHeightItem( 3 )

MENU oMenu 2015 ;   
        COLORSELECT    cClrSelIni, cClrSelFin, cClrSelTxt ;
        COLORSEPARATOR cClrSelBor ;  
        COLORMENU      cClrMenu, cClrMenuTxt ;
        FONT oFontMenu LINESVERT COLORS ;
        ROUND 7 ;
        UPPERMNU ADJUST ;
        HEIGHT 3.2
 
    MENUITEM TE(0007,'ส่วนการจอง','Reservation') WHEN lCloseDay ;
              RESOURCE "NEWBK1" 

   MENU NOINHERIT  ;
        NOBORDER ;
        ROUND 7 ;
        HEIGHT 2.5

      MENUITEM TE(0007,'การจองห้องพัก','Reservation') WHEN UserRights(001,.F.) .and. lCloseDay ;
                RESOURCE "NEWBK1" 
   ......
  ENDMENU


free image host

After call MENU (RIGHT CLICK) in other function as below
Code (fw): Select all Collapse
Function Sub.....
    oTbw:bRClicked := { | nRow, nCol, nFlags | ( oTbw:SetFocus(), oTbw:lButtonDown(nRow,nCol), RsvnMenu( nRow, nCol, rDlg, oTbw, oBtn, lGrpOpt ) ) }
return nil


*-----------------------------------------------------------------------*
Function RsvnMenu( nRow, nCol, rDlg, oTbw, oBtn, lGrpOpt )
local oRsMenu

    MENU oRsMenu POPUP 2015 ;
         UPPERMNU ADJUST ;
         HEIGHT 1.7

                  MENUITEM 'Edit Book' 
                  .........
   ENDMENU

   ACTIVATE POPUP oRsMenu OF rDlg AT nRow, nCol+4




When I return to the Main Menu, it paint incorrect size as below.

capture screen

Thank you in advance for any help.
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: MENU paint Issue
Posted: Tue Aug 07, 2018 02:11 AM

If I don't set HEIGHT 1.7 in Sub Menu. The Main Menu doesn't change.

I don't know why HEIGHT define in submenu that effect to Main Menu Function.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: MENU paint Issue
Posted: Tue Aug 07, 2018 11:18 AM
dutch wrote:If I don't set HEIGHT 1.7 in Sub Menu. The Main Menu doesn't change.

I don't know why HEIGHT define in submenu that effect to Main Menu Function.


Dear Dutch
Please try with this sample
After I explain better this issue

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

Static oFont
Static oFontMenu
Static oWnd

Function Main()

   Local oMnu
   Local cFont   := "Tahoma"
   Local cFontH  := -14

   DEFINE FONT oFont NAME "TIMES NEW ROMAN" SIZE 0,-12
   DEFINE FONT oFontMenu NAME cFont SIZE 0, cFontH WEIGHT 300
 
   DEFINE WINDOW oWnd MENU ( oMnu := MakeMenu() ) TITLE FWVERSION

   oWnd:bRClicked := { | r, c | MyPopup( r, c ) }

   ACTIVATE WINDOW oWnd CENTERED

   RELEASE FONT oFont
   RELEASE FONT oFontMenu

Return nil

//----------------------------------------------------------------------------//
 
function MakeMenu()
 
   local oMenu, oMnu1, oMnu2
 
   MENU oMenu 2015 HEIGHT 2.8 FONT oFontMenu
      MENUITEM "One" //FILE "..\bitmaps\full.bmp"
      MENU
         MENUITEM "Sunday"  CHECKED
         MENUITEM SEPARATOR Upper( "Select" )
         MENUITEM "Monday" + CRLF + "Other"  BOLD  RADIOCHECK 3, 2
         MENUITEM "Tuesday"  ACTION MsgInfo( "Hola" ) ITALIC
         MENUITEM "Wednesday"
         SEPARATOR
         MENUITEM "Thursday" FILE "..\bitmaps\full.bmp"
         SEPARATOR
         MENUITEM "Exit" ACTION oWnd:End() HSYSBITMAP 5
      ENDMENU
      MENUITEM "Two"
      MENU //oMnu2
         MENUITEM "Sunday" HSYSBITMAP 9
         SEPARATOR
         MENUITEM "Monday" HSYSBITMAP 11
      ENDMENU
   ENDMENU
 
return oMenu

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

Function MyPopup( nRow, nCol )

   local oMenuNew
   local nOldH     := GetnHeightItem()

   MENU oMenuNew POPUP 2015 HEIGHT 4 FONT oFontMenu
            
      MENUITEM "New &Dialog" 
      SEPARATOR
      MENUITEM "New &Bitmap" CHARICON 57696
      SEPARATOR
      MENUITEM "New &Bitmap" CHARICON 57698
      SEPARATOR
      MENUITEM "New &Icon" CHARICON 57697

   ENDMENU

   ACTIVATE POPUP oMenuNew OF oWnd AT nRow, nCol

   GetnHeightItem( nOldH )

Return nil

//----------------------------------------------------------------------------//
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: MENU paint Issue
Posted: Tue Aug 07, 2018 02:56 PM
cnavarro wrote:
dutch wrote:If I don't set HEIGHT 1.7 in Sub Menu. The Main Menu doesn't change.

I don't know why HEIGHT define in submenu that effect to Main Menu Function.


Dear Dutch
Please try with this sample
After I explain better this issue

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

Static oFont
Static oFontMenu
Static oWnd

Function Main()

   Local oMnu
   Local cFont   := "Tahoma"
   Local cFontH  := -14

   DEFINE FONT oFont NAME "TIMES NEW ROMAN" SIZE 0,-12
   DEFINE FONT oFontMenu NAME cFont SIZE 0, cFontH WEIGHT 300
 
   DEFINE WINDOW oWnd MENU ( oMnu := MakeMenu() ) TITLE FWVERSION

   oWnd:bRClicked := { | r, c | MyPopup( r, c ) }

   ACTIVATE WINDOW oWnd CENTERED

   RELEASE FONT oFont
   RELEASE FONT oFontMenu

Return nil

//----------------------------------------------------------------------------//
 
function MakeMenu()
 
   local oMenu, oMnu1, oMnu2
 
   MENU oMenu 2015 HEIGHT 2.8 FONT oFontMenu
      MENUITEM "One" //FILE "..\bitmaps\full.bmp"
      MENU
         MENUITEM "Sunday"  CHECKED
         MENUITEM SEPARATOR Upper( "Select" )
         MENUITEM "Monday" + CRLF + "Other"  BOLD  RADIOCHECK 3, 2
         MENUITEM "Tuesday"  ACTION MsgInfo( "Hola" ) ITALIC
         MENUITEM "Wednesday"
         SEPARATOR
         MENUITEM "Thursday" FILE "..\bitmaps\full.bmp"
         SEPARATOR
         MENUITEM "Exit" ACTION oWnd:End() HSYSBITMAP 5
      ENDMENU
      MENUITEM "Two"
      MENU //oMnu2
         MENUITEM "Sunday" HSYSBITMAP 9
         SEPARATOR
         MENUITEM "Monday" HSYSBITMAP 11
      ENDMENU
   ENDMENU
 
return oMenu

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

Function MyPopup( nRow, nCol )

   local oMenuNew
   local nOldH     := GetnHeightItem()

   MENU oMenuNew POPUP 2015 HEIGHT 4 FONT oFontMenu
            
      MENUITEM "New &Dialog" 
      SEPARATOR
      MENUITEM "New &Bitmap" CHARICON 57696
      SEPARATOR
      MENUITEM "New &Bitmap" CHARICON 57698
      SEPARATOR
      MENUITEM "New &Icon" CHARICON 57697

   ENDMENU

   ACTIVATE POPUP oMenuNew OF oWnd AT nRow, nCol

   GetnHeightItem( nOldH )

Return nil

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


I run it. Look OK.
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: MENU paint Issue
Posted: Tue Aug 07, 2018 03:03 PM
Very good mister Navarro, thanks.



Regards,
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: MENU paint Issue
Posted: Tue Aug 07, 2018 11:02 PM
Dear Mr.Navarro,

Thank you so much, It fixed. What is the problem?
cnavarro wrote:
dutch wrote:If I don't set HEIGHT 1.7 in Sub Menu. The Main Menu doesn't change.

I don't know why HEIGHT define in submenu that effect to Main Menu Function.


Dear Dutch
Please try with this sample
After I explain better this issue

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

Static oFont
Static oFontMenu
Static oWnd

Function Main()

   Local oMnu
   Local cFont   := "Tahoma"
   Local cFontH  := -14

   DEFINE FONT oFont NAME "TIMES NEW ROMAN" SIZE 0,-12
   DEFINE FONT oFontMenu NAME cFont SIZE 0, cFontH WEIGHT 300
 
   DEFINE WINDOW oWnd MENU ( oMnu := MakeMenu() ) TITLE FWVERSION

   oWnd:bRClicked := { | r, c | MyPopup( r, c ) }

   ACTIVATE WINDOW oWnd CENTERED

   RELEASE FONT oFont
   RELEASE FONT oFontMenu

Return nil

//----------------------------------------------------------------------------//
 
function MakeMenu()
 
   local oMenu, oMnu1, oMnu2
 
   MENU oMenu 2015 HEIGHT 2.8 FONT oFontMenu
      MENUITEM "One" //FILE "..\bitmaps\full.bmp"
      MENU
         MENUITEM "Sunday"  CHECKED
         MENUITEM SEPARATOR Upper( "Select" )
         MENUITEM "Monday" + CRLF + "Other"  BOLD  RADIOCHECK 3, 2
         MENUITEM "Tuesday"  ACTION MsgInfo( "Hola" ) ITALIC
         MENUITEM "Wednesday"
         SEPARATOR
         MENUITEM "Thursday" FILE "..\bitmaps\full.bmp"
         SEPARATOR
         MENUITEM "Exit" ACTION oWnd:End() HSYSBITMAP 5
      ENDMENU
      MENUITEM "Two"
      MENU //oMnu2
         MENUITEM "Sunday" HSYSBITMAP 9
         SEPARATOR
         MENUITEM "Monday" HSYSBITMAP 11
      ENDMENU
   ENDMENU
 
return oMenu

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

Function MyPopup( nRow, nCol )

   local oMenuNew
   local nOldH     := GetnHeightItem()

   MENU oMenuNew POPUP 2015 HEIGHT 4 FONT oFontMenu
            
      MENUITEM "New &Dialog" 
      SEPARATOR
      MENUITEM "New &Bitmap" CHARICON 57696
      SEPARATOR
      MENUITEM "New &Bitmap" CHARICON 57698
      SEPARATOR
      MENUITEM "New &Icon" CHARICON 57697

   ENDMENU

   ACTIVATE POPUP oMenuNew OF oWnd AT nRow, nCol

   GetnHeightItem( nOldH )

Return nil

//----------------------------------------------------------------------------//
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: MENU paint Issue *Fixed*
Posted: Wed Aug 08, 2018 07:42 PM

Dear Dutch

My idea is to provide the TMenuItem class with a nHeight data
As this classes are very sensitive to changes, especially to maintain compatibility with older versions of Fw, I did not want to add more changes to the classes until it took a while to run and checked for stability.
It remains pending to implement for future versions
Currently the item's height is calculated with the selected font and/or with the function GetnHeightItem (SETGET), so if we want to be sure not to perform global settings at the height of the items, we must save the value that has that value to be able to restore it later

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: MENU paint Issue *Fixed*
Posted: Thu Aug 09, 2018 03:29 AM
Dear Navarro,

Thank you so much for your explanation. I've got it's "backward compatible" reason.
cnavarro wrote:Dear Dutch

My idea is to provide the TMenuItem class with a nHeight data
As this classes are very sensitive to changes, especially to maintain compatibility with older versions of Fw, I did not want to add more changes to the classes until it took a while to run and checked for stability.
It remains pending to implement for future versions
Currently the item's height is calculated with the selected font and/or with the function GetnHeightItem (SETGET), so if we want to be sure not to perform global settings at the height of the items, we must save the value that has that value to be able to restore it later
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 99
Joined: Mon Aug 09, 2010 11:00 AM
Re: MENU paint Issue *Fixed*
Posted: Mon Feb 04, 2019 07:31 AM

Any News about it ??

TX

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: MENU paint Issue *Fixed*
Posted: Mon Feb 04, 2019 10:27 AM

Please provide an example of what you need and an image to see your problem.

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces

Continue the discussion