AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[module] MMenu 1.0 b1
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
fuzzles



Joined: 03 Aug 2008
Posts: 2

PostPosted: Sun Aug 03, 2008 2:44 am    Post subject: Reply with quote

how to repace the gui, menu toolbar (File, help...) with the mmenu ?

cant get it to work this way.
Back to top
View user's profile Send private message
Learning one



Joined: 04 Apr 2009
Posts: 1001
Location: Croatia

PostPosted: Tue Dec 29, 2009 11:54 pm    Post subject: Reply with quote

Just wanted to bring MMenu back to 1. page and say:
Majkinetor, thank you for MMenu!
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Wed Dec 30, 2009 8:52 am    Post subject: Reply with quote

You are welcome Very Happy
_________________
Back to top
View user's profile Send private message
Deo
Guest





PostPosted: Wed May 05, 2010 11:09 pm    Post subject: Icons Resize Reply with quote

Hi all
Is it possible to resize icons of items in menu (all icons set through path:index even if index = 0) to the selected size explicitly?
Currently all icons got through the path:index are 32x32 even if icon size in menu is 16x16
it looks like on screenshots
Code:

SIZE_OF_ICONS_DEFAULT := 16 ; 16,24,32

MHandl1 := MMenu_Create("S" . SIZE_OF_ICONS_DEFAULT)
MMenu_Add(MHandl1, "shortcut", "shell32.dll:4" ,"","")
MMenu_Add(MHandl1, "shortcut1", "shell32.dll:5" ,"","")
MMenu_Add(MHandl1, "shortcut2", "shell32.dll:6" ,"","")

MouseGetPos,X,Y
MMenu_Show(MHandl1,X,Y, "Target")

#Include include
#Include MMenu.ahk
#Include Structs.ahk
return

Target:
exitapp


size of icons - 32
http://img94.imageshack.us/i/screenshot00037c.png/ - size 16
http://img26.imageshack.us/i/screenshot00036r.png/ - size 32
Back to top
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Thu May 06, 2010 6:10 am    Post subject: Reply with quote

As far as I remember, setting size does not work for icons in the dll. If u use icons from ico files it will work.
_________________
Back to top
View user's profile Send private message
Deo
Guest





PostPosted: Thu May 06, 2010 8:59 am    Post subject: Reply with quote

yea, i've noticed that ico resized correctly, but not ico:0
it's a little disappointing, because resizing to desired size working correctly for TreeView control icons or for Gui Picture control
resizing also work for "Menu Icons"
Is it possible to implement resizing into the MMenu code? I would very appreciate it
Back to top
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Thu May 06, 2010 9:55 am    Post subject: Reply with quote

Yes, definitely, but I don't have time for that atm. You could try it yourself
_________________
Back to top
View user's profile Send private message
Deo
Guest





PostPosted: Thu May 06, 2010 12:37 pm    Post subject: Reply with quote

ok, i've changed the code of MMenu.ahk so it now resize icons properly

Code:
MMenu_loadIcon(pPath, pSize=0)
{
   idx := InStr(pPath, ":", 0, 0)

   if idx >=4
   {
      resPath := SubStr( pPath, 1, idx-1)
      resIdx  := Substr( pPath, idx+1, 8)

;~       return MMenu_GetIcon( resPath, resIdx )
      return DllCall("user32\CopyImage"
                        , "UInt", MMenu_GetIcon(resPath,resIdx) ;icon handle
                        , "uint", 2      ; IMAGE_ICON
                        , "int", pSize
                        , "int", pSize
                        , "UInt",0x8)   ;LR_COPYDELETEORG

   }
   return,  DllCall( "LoadImage"
                     , "uint", 0
                     , "str", pPath
                     , "uint", 2                ; IMAGE_ICON
                     , "int", pSize
                     , "int", pSize
                     , "uint", 0x10 | 0x20)     ; LR_LOADFROMFILE | LR_TRANSPARENT
}

think it would be useful to include this fix into the topic's bundle
Back to top
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Thu May 06, 2010 1:40 pm    Post subject: Reply with quote

Thanks.
_________________
Back to top
View user's profile Send private message
Petru



Joined: 17 Dec 2007
Posts: 235
Location: Galati, Romania

PostPosted: Fri May 14, 2010 1:32 pm    Post subject: Reply with quote

How can I use MMenu to create menubars for GUIs?
Back to top
View user's profile Send private message Yahoo Messenger
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Fri May 14, 2010 4:07 pm    Post subject: Reply with quote

The only way to do it is to create standard AHK menu bar, then display MMenu when user clicks the main menu item, precisely positioned bellow the clicked item.

The same goes for Tray menu.

However, this will not be complete simulation unless you also monitor LEFT|RIGHT arrow which normally jumps to different menus of the main menu while menu is being open.
_________________
Back to top
View user's profile Send private message
Deo



Joined: 16 May 2010
Posts: 172

PostPosted: Sat May 22, 2010 9:30 am    Post subject: Reply with quote

Man, can you advice plz, what i need to change in the MMenu code to disable checkmarks at all and free space to the left from menu item that holded for it
I think i need to change menu item style by inserting the num
MNS_NOCHECK = 0x80000000
But i can't find the exact place in code where it can be used
Back to top
View user's profile Send private message
godsstigma



Joined: 04 Nov 2008
Posts: 222
Location: Memphis, TN

PostPosted: Thu Jun 10, 2010 10:49 pm    Post subject: Reply with quote

Is there a way to remove a separator without having to destroy and re-build the menu?
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Fri Jun 11, 2010 9:26 am    Post subject: Reply with quote

Yes. Use its ID or position to remove it. MMenu is dynamic thing. You can delete, edit or remove items during run time.
_________________
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Wed Jun 16, 2010 1:01 pm    Post subject: Reply with quote

Deo wrote:
I think i need to change menu item style by inserting the num
MNS_NOCHECK = 0x80000000
It must be applied by calling SetMenuInfo. For instance,
Code:
MMenu_setMenuStyle( menu, 0x80000000 )
...
MMenu_setMenuStyle( pMenu, dwStyle ) {
   local  hMenu := MMenu_aMenu[%pMenu%]

   MMenu_mi_fMask      := 0x10      ;MIM_STYLE
   MMenu_mi_dwStyle   := dwStyle

   MENUINFO_Set("MMenu_mi")
   API_SetMenuInfo( hMenu, &MMenu_mi )
}

However, since MMenu custom measures and draws all items, setting the style isn't sufficient. The following line in MMenu_onDraw unconditionally adjusts the icon position by the size of a standard checkmark:
Code:
   API_DrawIconEx(MMenu_di_hDC, (API_GetMenuCheckMarkDimensions() & 0xFFFF) + 4, MMenu_di_rcItem_Top, MMenu_di_itemData, 0, 0, 0, 0, 3)

There are a few solutions:
  • If you'll never use check marks, remove the red code and set the MNS_NOCHECK style for every menu.
  • Use GetMenuInfo to determine whether the menu has MNS_NOCHECK before making the adjustment.
  • Add a variable for each menu to track whether it has MNS_NOCHECK, and check this before making the adjustment.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
Page 8 of 10

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group