Windows 10 style menus

Windows 10 style menus

Postby James Bott » Tue Mar 15, 2016 4:18 pm

I am trying to implement Windows 10 style menus. They are black text on a white background. I am using this code to force the correct colors:

Code: Select all  Expand view
   MENU oMenu COLORMENU CLR_WHITE,CLR_BLACK


However there is an apparent bug in that the background is only applied to the area around the text, not the entire background. Below is a screenshot. The foreground image is my test program and the background image is the Windows 10 File Explorer.

Image

I also note that the font in my test is about one point larger than the default font being used by Windows 10 (most noticeable in the letter H in "Home"). Not a big issue as the font can be defined, but it would seem the menu font should be defaulting to the same one that Windows is using. Maybe this is not easy?

I am using FW 15.5, perhaps this has been fixed in a newer version?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Windows 10 style menus

Postby cnavarro » Tue Mar 15, 2016 4:29 pm

James Bott wrote:I am trying to implement Windows 10 style menus. They are black text on a white background. I am using this code to force the correct colors:

Code: Select all  Expand view
   MENU oMenu COLORMENU CLR_WHITE,CLR_BLACK


However there is an apparent bug in that the background is only applied to the area around the text, not the entire background. Below is a screenshot. The foreground image is my test program and the background image is the Windows 10 File Explorer.

Image

I also note that the font in my test is about one point larger than the default font being used by Windows 10 (most noticeable in the letter H in "Home"). Not a big issue as the font can be defined, but it would seem the menu font should be defaulting to the same one that Windows is using. Maybe this is not easy?

I am using FW 15.5, perhaps this has been fixed in a newer version?

James


James, in later versions is fixed
I will see how you can fix your version
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Windows 10 style menus

Postby James Bott » Tue Mar 15, 2016 4:34 pm

Cristobal,

James, in later versions is fixed


Thanks. Is the font also fixed? I find that the font is defaulting to 12 pts and it should be 11 pts.

I will upgrade to the latest version.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Windows 10 style menus

Postby James Bott » Tue Mar 15, 2016 6:58 pm

It just occurred to me that the Win 10 File Explorer doesn't use menus anymore, they are folder tabs (I think) that call up the ribbonbar.

However, I looked at Win 10's Notepad which does have menus, and they are the same font and size as File Explorer. So, although File Explorer wasn't the best choice for a model, it worked out OK.
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Windows 10 style menus

Postby James Bott » Tue Mar 15, 2016 10:15 pm

Ok, I upgraded to FW 16.2 and everything looks great! The menu default font is now Windows 10 standard. The menu color still has to be specified, but at least it affects the entire menu line.

The top app in the image below is Windows' Notepad and the bottom one is my test program.

I like the new Win 10 look.

Thank you Cristobal for pointing out that the new version was fixed, and thank you Antionio for making those changes.

Image
Last edited by James Bott on Tue Mar 15, 2016 11:21 pm, edited 1 time in total.
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Windows 10 style menus

Postby James Bott » Tue Mar 15, 2016 11:04 pm

I found a little bug in menus in version FWH 16.02.

If you open a FW program, then move the cursor over a menu item, it is not highlighted. In Windows 10 Notepad it is. If you move across the top level menu items, none are highlighted. In Windows 10 each is highlighted when the cursor is over them.

It the FW menu, if you click on a (top-level) menu item so the dropdown menu appears, then the top level menu item is highlighted. And if you then move to another top-level menu item it is highlighted. i.e. it acts as the standard Win 10 menu only after one menu item has been clicked.

Here is a little test program. To test, move the cursor over any of the top level menu items and there will be no highlighting. Then click on File (File will be highlighted). Then move the cursor across the other menu items and they each will be highlighted.

To test a standard Windows program try the same things with Notepad.

Code: Select all  Expand view
#include "Fivewin.ch"
#include "Colors.ch"


FUNCTION MAIN()

    LOCAL oWnd, oMenu
   
    MENU oMenu COLORMENU CLR_WHITE,CLR_BLACK
     
        MENUITEM "File"

        MENU
            MENUITEM "Exit" action oWnd:end()
        ENDMENU
       
        MENUITEM "Edit"
        MENUITEM "Format"
        MENUITEM "View"
        MENUITEM "Help"
    ENDMENU

    DEFINE WINDOW oWnd;
           MENU oMenu TITLE "Untitled - Fivewin"

    ACTIVATE WINDOW oWnd
   
RETURN NIL
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Windows 10 style menus

Postby cnavarro » Wed Mar 16, 2016 1:47 am

Yes, is one old problem of menus
I take time researching how to fix it
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Windows 10 style menus

Postby dtussman » Wed Mar 16, 2016 5:23 pm

James, I notice the same exact thing.
dtussman
 
Posts: 97
Joined: Sat Jun 06, 2015 6:57 pm

Re: Windows 10 style menus

Postby James Bott » Wed Mar 16, 2016 9:36 pm

Cristobal,

I looked at the TMenu.prg and there is one significant thing I noticed. This class used to inherit from TControl, but that was commented out so now it doesn't inherit from any other class. Of course, this means that it doesn't have access to all the methods and data in TWindow and TControl. So we have no access to onMouseOver, or bMouseOver with which to change the colors.

Antonio, do you have any ideas how to fix the color on mouse-over?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Windows 10 style menus

Postby cnavarro » Wed Mar 16, 2016 10:05 pm

James ( excuse my poor english )

No, TMenu in previous versions, does not inherit from TControl
He has never inherited from TControl
When I started to develop new menus, my first idea was to have inherited from TControl to use all datas and methods, but Mr Rao said that gave me problems with xHarbour and that the class TMenu was not control
So not inherit from TControl (although I'm still doing tests when my time permits me)
In this case the onmouse ( MouseMove, etc ), should be replaced by
lAnd(GETDRAWISR (pItemStruct) [5], ODS_HOTLIGHT)
But it is not easy, but I keep doing tests
Thank you for your comments and your help
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Windows 10 style menus

Postby James Bott » Wed Mar 16, 2016 11:37 pm

Christobal,

Well that explains a lot--I didn't know that you had developed the menu class.

I took a look at it and I have no idea how it works. I'm sure you spent many hours developing this. It would be very nice if it did look exactly like the standard windows app's menus when the top bar item's were moused over.

If I can be of any help in this task, please let me know.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Windows 10 style menus

Postby cnavarro » Thu Mar 17, 2016 12:03 am

James,
It was a very hard task to get the new menus are stable
The painted items when the mouse is over, I tried to fix it for some time, but we must be very careful to avoid damaging the current functioning
My goal is to fix
Thank you
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Windows 10 style menus

Postby cnavarro » Thu Mar 17, 2016 1:59 pm

James Bott wrote:Christobal,

If I can be of any help in this task, please let me know.

Regards,
James


James, you use Fwh 16.02 version ?
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Windows 10 style menus

Postby James Bott » Thu Mar 17, 2016 2:25 pm

Cristobal,

James, you use Fwh 16.02 version ?


Yes.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Windows 10 style menus

Postby cnavarro » Thu Mar 17, 2016 2:46 pm

Please, send me your mail

Ok, thanks
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Natter and 84 guests