Jump to content


Photo

Custom Popup Menu Dll


  • Please log in to reply
7 replies to this topic

#1 doug25

doug25

    GMC Member

  • New Member
  • 35 posts

Posted 12 November 2009 - 12:54 PM

Custom windows popup menus

Posted Image

functions :

WPM_initDll()
WPM_createPopupMenu(border color)
WPM_showPopupMenu(x, y) : returns the selected item or 0 if no item was selected
WPM_destroyPopupMenu()
WPM_setItemFontSel(item index(zero based), font family, font size)
WPM_setItemFontNotSel(item index, font family, font size)
WPM_setItemsSize(width, height) : auto if not used
WPM_setItemIcon(item index, bitmap file name)
WPM_appendMenu(text) : returns item index (zero based)
WPM_setItemColors(item index, txton, txtoff, bkon, bkoff)
WPM_freeDll()

extra

WPM_setItemsToDefaultStyle(index begin, index end)
WPM_appendMenu2(string "item1|item2|item3")


completed project gm6 + gm7 :

download GM Custom Popup Menu

The dll no longer uses a windows hook ^_^

it's more robust

i've made two dll's with exactly the same functions (neither use a hook)

the difference is that WPM.dll will not prevent the mouse up events when the user chooses not to select an item
and WPM2.dll will take care of that. there might be different circumstances where you'd want to choose one over the other

Original Post :

I've made a dll that allows you to create a windows popup menu in the following ways :

set colors of text and background for individual selected / deselected menu items
set style of font for individual selected items
set style of font for individual unselected items
add a bitmap image as an icon for specified items with the bottom left corner defining the transparent colour
set the size of all items
show the popup menu and get the item selected

I really made this so i could have a custom popup menu in the game i'm working on.
It seems to work well but it's the second dll i've made so i'm probably very mistaken.
i can't spot any problems with it but i've also just completed it and tested it on one computer.

hope this is a legit dll for this forum area. there's probably a better way of programming this but i'm happy with the way it runs on my pc. the thing i don't like about it is i used a windows hook to handle the clicking issues on a popup menu's destruction. well, anyway, i'd appreciate somebody having a look at it and notifying me of any errors and by all means use the dll if you like it :D. or if there's a better implementation of a styled popup i'd like to have a look.

Enjoy

Edited by doug25, 22 November 2009 - 09:54 AM.

  • 0

#2 The Hidden app

The Hidden app

    It's here somewhere

  • New Member
  • 90 posts
  • Version:Unknown

Posted 12 November 2009 - 01:13 PM

I've made a dll that allows you to create a windows popup menu in the following ways :

set colors of text and background for individual selected / deselected menu items
set style of font for individual selected items
set style of font for individual unselected items
add a bitmap image as an icon for specified items with the bottom left corner defining the transparent colour
set the size of all items
show the popup menu and get the item selected

I really made this so i could have a custom popup menu in the game i'm working on.
It seems to work well but it's the second dll i've made so i'm probably very mistaken.
i can't spot any problems with it but i've also just completed it and tested it on one computer.

hope this is a legit dll for this forum area. there's probably a better way of programming this but i'm happy with the way it runs on my pc. the thing i don't like about it is i used a windows hook to handle the clicking issues on a popup menu's destruction. well, anyway, i'd appreciate somebody having a look at it and notifying me of any errors and by all means use the dll if you like it ^_^ . or if there's a better implementation of a styled popup i'd like to have a look.

hre's the gm6 link : Custom Windows Popup Menu in Game Maker

Enjoy

This looks useful, I just ran the gmk file and it said "Unexpected error occured when running the game", plz fix that and can you give a gm7 link, thnx :D
  • 0



#3 vadim647

vadim647

    Quite Epic

  • New Member
  • 840 posts

Posted 12 November 2009 - 01:40 PM

Posted Image
Wow! You, sir, are awesome.
And yes, this works only in gm6 and not in gm7 for some reason.
  • 0
We'll meet again, if you will find me.

#4 doug25

doug25

    GMC Member

  • New Member
  • 35 posts

Posted 12 November 2009 - 02:09 PM

glad you like it ^_^

i don't know why it doesn't work with gm7, but i do remember reading somewhere that the format of a dll may have to be altered for use with gm7. i'll have a further look into this
  • 0

#5 krele

krele

    GMC Member

  • GMC Member
  • 640 posts
  • Version:GM:Studio

Posted 24 November 2009 - 05:56 PM

Can this possibly have threading implemented? I don't want to use threading dll just to make this threaded...
  • 0

If I helped you, you can help me back :3

Brocoola


#6 doug25

doug25

    GMC Member

  • New Member
  • 35 posts

Posted 25 November 2009 - 12:25 PM

Can this possibly have threading implemented? I don't want to use threading dll just to make this threaded...


no, threading isn't used. what happens is an invisible window is created when a menu is shown, and this allows the menu to be customized ("owner-drawn") by using that window's window procedure, and as soon as the menu disappears the window is destroyed. but this shouldn't be a problem.
  • 0

#7 krele

krele

    GMC Member

  • GMC Member
  • 640 posts
  • Version:GM:Studio

Posted 28 November 2009 - 05:11 PM

Can this possibly have threading implemented? I don't want to use threading dll just to make this threaded...


no, threading isn't used. what happens is an invisible window is created when a menu is shown, and this allows the menu to be customized ("owner-drawn") by using that window's window procedure, and as soon as the menu disappears the window is destroyed. but this shouldn't be a problem.

So, does the game stop when the window is opened? Does it wait for the output/return?
  • 0

If I helped you, you can help me back :3

Brocoola


#8 doug25

doug25

    GMC Member

  • New Member
  • 35 posts

Posted 28 November 2009 - 09:00 PM

yes, no game code is executed until WPM_showPopupMenu() returns

:)
  • 0