Skip to content

dropdown

Thomas edited this page Aug 3, 2020 · 4 revisions

obj_uiZ_dropdown

A dropdown input box giving the user some input choice, based on an ds_list. On the left it displays what item is selected. On the right there is a button to open up a dropdown menu. The button consists of a background square and a triangle.

This requires a ds_list to be used, which cannot be set trough the designer and must be set trough code using the variables uselist and masklist.

Property Variables

  • buttoncolor[c_white]: The color the background of the button should be.
  • buttononcolor[c_gray]: The color the button should have when the mouse hovers over it.
  • buttonincolor[c_black]: The color the button should have when the mouse clicks it.
  • buttonbackalpha[1]: The alpha the background of the button.
  • buttontrianglealpha[1]: The alpha the triangle of the button should have.
  • buttontrianglecolor[c_black]: The color the triangle inside the button should be.
  • buttontriangleoncolor[c_dkgray]: The color the triangle inside the button should be when the mouse hovers over it.
  • buttontriangleincolor[c_white]: The color the triangle inside the button should be when the mouse clicks it.
  • buttonmargin[1]: The space between the button inside the dropdown box and the edge of the entire box.
  • trianglemargin[1]: The space between the triangle inside the button and the edge of the entire button itself.
  • uselist[-1]: Which ds list to use for the menu (each item in this ds_list will be one item inside inside the dropdown box) can contain both strings and reals.
  • masklist[-1]: If you have items inside your uselist that you want to use inside your code, but want your user to see something different inside the list, you can create an optional masklist which should the same size as your uselist.
  • textcolor[c_black]: The color text should have.
  • font[-1]: the font to use, a value of -1 means font will be ignored.
  • containtext[true]: Whether to run some code making sure that text isn't displayed outside the object.

Variables to control the mouse menu

(see obj_uiZ_mousemenu for more info)

  • mousebackcolor[c_blue]: The background color of the mouse menu.
  • mousebackalpha[0.5]: The alpha of the background of the mouse menu.
  • mouseitemcolor[c_white]: The main color each box in the menu has.
  • mouseitemoncolor[c_ltgray]: The main color a box in the menu has when the mouse hovers over it.
  • mouseitemincolor[c_ltgray]: The main color a box in the menu has when the mouse clicks it.
  • mouseitemalpha[1]: The alpha each box in the menu should have.
  • mousemargin[3]: The distance between two menu entries.
  • mousefont[-1]: the font to use inside the mouse menu, a value of -1 means font will be ignored.
  • mousetextcolor[c_black]: The color of the text inside the mouse menu.

This object has a background, and all its associated variables about which you can learn more here

Readable variables

  • maskvalue: A variable holding the current value of what the user can see inside the dropdownbox.
  • value: A variable holding the current value of the selected value inside the uselist. This is always a string.
  • menuis: A boolean that tells whether the item selection menu is showing right now.
  • updated: Whenever the user has entered a new value inside the box, this will be true.
  • select: The item number the mouse is currently over.
  • selected: The item number currently selected.

Functions

  • uiz_dropdown_setbuttoncolor(instanceid, color, mouse_on_color, mouse_in_color): set the color of button background (the button on the right of the dropdown with the triangle.)
    • instanceid: the instance id of the instance you want to modify
    • color[c_white]: The color the background of the button should be.
    • mouse_on_color[c_gray]: The color the button should have when the mouse hovers over it.
    • mouse_in_color[c_black]: The color the button should have when the mouse clicks it.
  • uiz_dropdown_setbuttontrianglecolor(instanceid, color, mouse_on_color, mouse_in_color):
    • instanceid: the instance id of the instance you want to modify
    • color[c_black]: The color the triangle inside the button should be.
    • mouse_on_color[c_dkgray]: The color the triangle inside the button should be when the mouse hovers over it.
    • mouse_in_color[c_white]: The color the triangle inside the button should be when the mouse clicks it.
  • uiz_dropdown_setbuttonalpha(instanceid,background[1],triangle[1]):
    • instanceid: the instance id of the instance you want to modify
    • background[1]: The alpha the background of the button.
    • triangle[1]: The alpha the triangle of the button should have.
  • uiz_dropdown_setmargins(instanceid, buttonmargin, trianglemargin):
    • instanceid: the instance id of the instance you want to modify
    • buttonmargin[1]: The space between the button inside the dropdown box and the edge of the entire box.
    • trianglemargin[1]: The space between the triangle inside the button and the edge of the entire button itself.
  • uiz_dropdown_setlist(instanceid, uselist, masklist):
    • instanceid: the instance id of the instance you want to modify
    • uselist[-1]: Which ds list to use for the menu (each item in this ds_list will be one item inside inside the dropdown box) can contain both strings and reals.
    • masklist[-1]: If you have items inside your uselist that you want to use inside your code, but want your user to see something different inside the list, you can create an optional masklist which should the same size as your uselist.
  • uiz_dropdown_settextsettings(instanceid, color, font, containtext): Set the settings for the text displayed in the dropdown widget (so not the submenu)
    • instanceid: the instance id of the instance you want to modify
    • color[c_black]: The color text should have.
    • font[-1]: the font to use, a value of -1 means font will be ignored.
    • containtext[true]: Whether to run some code making sure that text isn't displayed outside the object.
  • uiz_dropdown_setmenusettings(instanceid,mousebackcolor,mousebackalpha, mouseitemcolor,mouseitemoncolor,mouseitemincolor,mouseitemalpha,mousemargin,mousefont,mousetextcolor): Settings that are applied to the submenu.
    • instanceid: the instance id of the instance you want to modify
    • mousebackcolor[c_blue]: The background color of the mouse menu.
    • mousebackalpha[0.5]: The alpha of the background of the mouse menu.
    • mouseitemcolor[c_white]: The main color each box in the menu has.
    • mouseitemoncolor[c_ltgray]: The main color a box in the menu has when the mouse hovers over it.
    • mouseitemincolor[c_ltgray]: The main color a box in the menu has when the mouse clicks it.
    • mouseitemalpha[1]: The alpha each box in the menu should have.
    • mousemargin[3]: The distance between two menu entries.
    • mousefont[-1]: the font to use inside the mouse menu, a value of -1 means font will be ignored.
    • mousetextcolor[c_black]: The color of the text inside the mouse menu.
  • uiz_dropdown_setvalue(instanceid,value): Set what value the dropdown hols. The select and selected values are also updated (by doing a ds_list_find_index). If possible, use the _listpos variant, because it is faster.
    • instanceid: the instance id of the instance you want to modify
    • value: what text should be displayed in the dropdown box.
  • uiz_dropdown_setvalue_listpos(instanceid,list_pos): Sets the value of the box based on an index in your uselist.
    • instanceid: the instance id of the instance you want to modify
    • list_pos: what index of the uselist should be displayed in the box.
  • value=uiz_dropdown_getuselistvalue(instanceid):
    • value: A variable holding the current value of the selected value inside the uselist. This is always a string. If no masklist is set, then this is also the text visually displayed in the dropdown box.
    • instanceid: the instance id of the instance you want to read the property from
  • maskvalue=uiz_dropdown_getmasklistvalue(instanceid):
    • maskvalue: A variable holding the current value of what the user can see inside the dropdownbox.
    • instanceid: the instance id of the instance you want to read the property from
  • selected=uiz_dropdown_getselected(instanceid):
    • selected: The item number currently selected.
    • instanceid: the instance id of the instance you want to read the property from
  • menuis=uiz_dropdown_showsmenu(instanceid):
    • menuis: A boolean that tells whether the item selection menu is showing right now.
    • instanceid: the instance id of the instance you want to read the property from

Visuals

Wiki pages

🏑Home / General
πŸ“ƒTutorials
πŸ‘ͺ Parent
↕️ Positioning
πŸ›  Fixing & Updating
πŸ• Depth
πŸ“ƒ Templates and Examples
πŸŒ† Background
πŸ“‡ Structures
🎈 Objects

obj_uiZ_3waybutton
obj_uiZ_button
obj_uiZ_checkbox
obj_uiZ_clock
obj_uiZ_colorbox
obj_uiZ_cover
obj_uiZ_drawdslist obj_uiZ_dropdown
obj_uiZ_easybutton
obj_uiZ_frame
obj_uiZ_framescrollbar
obj_uiZ_functionbar
obj_uiZ_gradientsquare
obj_uiZ_gradientroundrect
obj_uiZ_gridlist
obj_uiZ_huesquare
obj_uiZ_loadingbar
obj_uiZ_loadingcircle
obj_uiZ_menubutton
obj_uiZ_mousemenu
obj_uiZ_radiobox
obj_uiZ_rotator
obj_uiZ_slider
obj_uiZ_scrollbar
obj_uiZ_slider_2col
obj_uiZ_slickslider
obj_uiZ_slideframe
obj_uiZ_sprbutton
obj_uiZ_spriteanimationbutton
obj_uiZ_spritecounter
obj_uiZ_stringbox
obj_uiZ_sliderstruct
obj_uiZ_surfacecanvas
obj_uiZ_sprite
obj_uiZ_square
obj_uiZ_squarebutton
obj_uiZ_swipicon
obj_uiZ_switch
obj_uiZ_tabslider
obj_uiZ_tabs
obj_uiZ_treelist
obj_uiZ_text
obj_uiZ_text_background
obj_uiZ_textarea
obj_uiZ_valuebox


🎈 Your own objects
🚫 Destroy
🐭 Mouse
πŸ’» Windows (uiz)
🌌 Animations
❓ General
πŸ“’ Numbers
πŸ“’ Strings
✏️ Draw
🚩 Popup
πŸ“‚ Files
πŸ’» Windows (os)

Clone this wiki locally