Page 1 of 1

DCMENU

Posted: Mon Dec 29, 2014 12:24 am
by Wolfgang Ciriack
Hi Roger,
Maybe the best thing is for you to write your own owner-drawing system using SUBCLASS, like Tom Liehr does with the browse system.
I don't see SUBCLASS in the dcdialog.ch for DCMENU...
How can I subclass the DCMENUITEM for changing the :measureitem function in ownerdraw menus ?

Re: DCMENU

Posted: Sat Jan 03, 2015 11:14 pm
by Wolfgang Ciriack
Hi Roger,
is subclassing for DCMENUITEMS implemented ?

Re: DCMENU

Posted: Mon Jan 05, 2015 8:32 am
by rdonnay
It looks like it is not implemented.

I will work on this.

Re: DCMENU

Posted: Mon Jan 05, 2015 9:48 am
by Wolfgang Ciriack
Thank you.

Re: DCMENU

Posted: Mon Jan 05, 2015 1:34 pm
by Auge_Ohr
Wolfgang Ciriack wrote:How can I subclass the DCMENUITEM for changing the :measureitem function in ownerdraw menus ?
as i know o:measureItem work only once while XBPMENUBAR_MIA_OWNERDRAW ( no Advance ) is used in Methode addItem() by Alaska.


for my native Controls i use this Code with ot4xb

Code: Select all

   ::oMeasureitemstruct    := MEASUREITEMSTRUCT():NEW()
   ::oMeasureitemstruct:_link_(lp,.F.)
//
// Member of MEASUREITEMSTRUCT()
//
   nCtlType    := ::oMeasureitemstruct:CtlType
   nCtlID      := ::oMeasureitemstruct:CtlID
   nitemID     := ::oMeasureitemstruct:itemID
   nWidth      := ::oMeasureitemstruct:itemWidth
   nHeight     := ::oMeasureitemstruct:itemHeight
   nitemData   := ::oMeasureitemstruct:itemData

   IF ::oMeasureitemstruct:itemID == -1
      RETURN
   ENDIF
   //
   // use Xbase++ Codeblock
   //
      IF VALTYPE( ::MeasureItem ) == "B"

         ::aDims := { ::oMeasureitemstruct:itemWidth ,;
                      ::oMeasureitemstruct:itemHeight  }

         aOld  := ACLONE(::aDims)
         //
         // now "send" it to Xbase++
         //
         EVAL( ::MeasureItem, ::oMeasureitemstruct:itemID , ::aDims , Self)

         //
         // after EVAL() if aDims have change "write" back to Structur
         //
         IF aOld[1] <> ::aDims[1]
            ::oMeasureitemstruct:itemWidth  := ::aDims[1]
         IF aOld[2] <> ::aDims[2]
            ::oMeasureitemstruct:itemHeight := ::aDims[2]
         ENDIF
         RETURN

      ENDIF
   ...
perhaps you can try to modify Measureitem Structur this Way.

Re: DCMENU

Posted: Mon Jan 05, 2015 3:39 pm
by rdonnay
I added sub-classing capability to DC_XbpMenu() and DC_XbpMenuBar().

Copy the attached _DCGETBX.PRG file to \exp19\source\dclipx and run BUILD19_SL1.BAT to rebuild DCLIPX.DLL.