MENU paint Issue *Fixed*

MENU paint Issue *Fixed*

Postby dutch » Tue Aug 07, 2018 12:11 am

I use menu in Main Function as sample below.
Code: Select all  Expand view
*------------------*
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
 


Imagefree image host

After call MENU (RIGHT CLICK) in other function as below
Code: Select all  Expand view

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
 


Image

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

Imagecapture screen

Thank you in advance for any help.
Last edited by dutch on Wed Aug 08, 2018 1:13 pm, edited 1 time in total.
Regards,
Dutch

FWH 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: MENU paint Issue

Postby dutch » Tue Aug 07, 2018 2: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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: MENU paint Issue

Postby cnavarro » 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: Select all  Expand view


#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
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: MENU paint Issue

Postby richard-service » Tue Aug 07, 2018 2: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: Select all  Expand view


#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 (r2402101027) => Borland C++ v7.7 32bit
MySQL v5.7 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 772
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: MENU paint Issue

Postby karinha » Tue Aug 07, 2018 3:03 pm

Very good mister Navarro, thanks.

Image

Regards,
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7353
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: MENU paint Issue

Postby dutch » 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: Select all  Expand view


#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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: MENU paint Issue *Fixed*

Postby cnavarro » Wed Aug 08, 2018 7: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
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: MENU paint Issue *Fixed*

Postby dutch » Thu Aug 09, 2018 3: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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: MENU paint Issue *Fixed*

Postby Uwe.Diemer » Mon Feb 04, 2019 7:31 am

Any News about it ??

TX
User avatar
Uwe.Diemer
 
Posts: 94
Joined: Mon Aug 09, 2010 11:00 am

Re: MENU paint Issue *Fixed*

Postby cnavarro » 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
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 36 guests