PlanetSquires Forums

Support Forums => José Roca Software => Topic started by: docroger on July 09, 2025, 03:43:50 PM

Title: AFX2 bug in menu MF_SEPARATOR
Post by: docroger on July 09, 2025, 03:43:50 PM
Hello,

On Tiko 1.1.1, i use DDT for transfert Powerbasic app.

The exemple below is from exddtmenu01 template, simplified.

There is a bug with menu :

FUNCTION BuildMenu (BYVAL hDlg AS HWND) AS HMENU
   DIM lResult AS LONG

   ' ** First create a top-level menu:
   DIM hMenu AS HMENU = MenuNewBar

   ' ** Add a top-level menu item with a popup menu:
   DIM hPopup1 AS HMENU = MenuNewPopup
   MenuAddPopup hMenu, "&File", hPopup1, MF_ENABLED
   MenuAddString hPopup1, "&Open", ID_OPEN, MF_ENABLED
   MenuAddString hPopup1, "-", 0, 0
   MenuAddString hPopup1, "&Exit", ID_EXIT, MF_ENABLED
   

   ' ** Now we can add another item to the menu that will bring up a sub-menu.
   ' First we obtain a new popup menu handle to distinguish it from the first
   ' popup menu:
   
   
   ' Attach the menu to the dialog
   MenuAttach hMenu, hDlg

   ' // Bold the Exit menu item
   MenuBoldItem(hMenu, ID_EXIT)
   ' // Right justify the Help menu
'   MenuRightJustifyItem(hMenu, 1)

   RETURN hMenu
END FUNCTION



The menu separator appear on last position after exit and not before.

Any help appreciated.
Thankx.
Title: Re: AFX2 bug in menu MF_SEPARATOR
Post by: José Roca on July 09, 2025, 04:34:08 PM
In AfxMenuProcs2.inc change this line of MenuAddString:

IF wszText = "-" THEN RETURN AppendMenuW(hMenu, MF_SEPARATOR, 0, "")

change to:

IF wszText = "-" THEN RETURN AppendMenuW(hMenu, MF_SEPARATOR, 1, "")
Title: Re: AFX2 bug in menu MF_SEPARATOR
Post by: José Roca on July 10, 2025, 05:05:21 AM
> On Tiko 1.1.1, i use DDT for transfert Powerbasic app.

Be warned that this is not ready for production code. It is a work in progress.

Probably it will be added later to AfxNova, another framework in progress.
Title: Re: AFX2 bug in menu MF_SEPARATOR
Post by: docroger on July 10, 2025, 05:52:56 AM
Hello,

Thanx for quick response. Nice.

With latest version of afx2, my app no more compile... i see i must add #define _win32_winnt &h0602...

The filecopy.avi in template dir is corrupted... i take the one with powerbasic sample and all work again.

I continue my transfert of powerbasic app... more simple to translate to Purebasic (i am an old user of Purebasic).

Have a nice day and continue good job.
Title: Re: AFX2 bug in menu MF_SEPARATOR
Post by: José Roca on July 10, 2025, 11:45:12 AM
Thanks for pointing it. I have added

*.avi binary

to the .gitattributes file.

> see i must add #define _win32_winnt &h0602..

Yes. The FreeBasic headers are outdated. I think that they have made small changes to it.

I have added #define _WIN32_WINNT &h0602 to the templates.