MenuItem with "Checkbox"

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

MenuItem with "Checkbox"

Post by AUGE_OHR »

hi,

i can use a Bitmap as IMAGE for MenuItem

is it possible to "simulate" a Checkbox (switch Image) and use "Result" ( .T. / .F. ) under harbour HMG :idea:
Menu_CheckItem.jpg
Menu_CheckItem.jpg (25.46 KiB) Viewed 840 times
have fun
Jimmy
User avatar
gfilatov
Posts: 1090
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: MenuItem with "Checkbox"

Post by gfilatov »

AUGE_OHR wrote: Wed Jan 06, 2021 1:25 am hi,

i can use a Bitmap as IMAGE for MenuItem

is it possible to "simulate" a Checkbox (switch Image) and use "Result" ( .T. / .F. ) under harbour HMG :idea:
Hi Jimmy,

This feature will require an OWNERDRAW menu items support which is missed in the official HMG.

BTW It is possible in the MiniguiEx with the following simple code:

Code: Select all

/*
 * MiniGUI Menu Demo
 */

#include "minigui.ch"

PROCEDURE MAIN

   LOCAL n
   LOCAL m_char

   IF PCount() == 0
      SET MENUSTYLE EXTENDED
   ELSE
      SET MENUSTYLE STANDARD
   ENDIF

   DEFINE WINDOW Win_1 ;
      AT 0, 0 ;
      WIDTH 400 ;
      HEIGHT 400 ;
      TITLE 'Menu Demo 2' ;
      MAIN

      DEFINE MAIN MENU

      POPUP "&Option"

         FOR n := 1 TO 3
            m_char := 'item' + StrZero( n, 2 )
            MENUITEM 'EXE ' + m_char ACTION MenuProc() NAME &m_char CHECKED
         NEXT

         Win_1.item02.Checked := .F.

         SEPARATOR

         MENUITEM 'Exit' ACTION Win_1.Release

      END POPUP

      POPUP '&Help'

         MENUITEM '&About' ACTION MsgInfo ( MiniGuiVersion(1) )

      END POPUP

      END MENU

      IF IsExtendedMenuStyleActive()
         HMG_SetMenuTheme( MNUCLR_THEME_DARK )
      ENDIF

   END WINDOW

   ACTIVATE WINDOW Win_1

RETURN


PROCEDURE MenuProc()

   IF This.Name == '01'
      MsgInfo ( 'Action 01', This.Caption )

   ELSEIF This.Name == '02'
      MsgInfo ( 'Action 02', This.Caption )

   ELSEIF This.Name == '03'
      MsgInfo ( 'Action 03', This.Caption )

   ENDIF

RETURN
Take a look for a result image below:
Attachments
menu extended with checkboxes
menu extended with checkboxes
menu.jpg (8.41 KiB) Viewed 815 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
Post Reply