Skip to content

swipicon

Thomas S edited this page Aug 13, 2020 · 3 revisions

obj_uiZ_swipicon

This object is an icon/button that can be moved around by the end user, kind of like a MS Windows desktop icon.

It also has some text under the icon. This text has has a background, see backgrounds. This background has an "out" background value which will be activated if the icon is selected.

This is an object of which the user can change it' s position. You as a developer can still change the position of it, but right after that's done these variables will be changed to:

posinframex=uiz_static;
posinframey=uiz_static;

uiz_static means that the object will be put in a state where the value position compute layer of uiz will be removed, meaning that the raw variables "x", "y", "width" and "height" now have to be used for manipulating the object which is normally not the way to change the object. If you do want to change the objects position after you have initially set it you can use code like this ("a" refers to an instance of this object):

a.posinframex=dp;
a.posinframey=px;
a.posvalx=3;
a.posvaly=50;

If you want to change the width/height of the object a code like this should be used:

a.posinframex=px;
a.posinframey=px;
a.posvalx=a.x;
a.posvaly=a.y;
a.posvalwtype=dp;
a.posvalhtype=fc;
a.posvalw=0.5;
a.posvalh=0.5;

Property Variables

  • sprite[spr_uiZ_button]: The sprite to use as the icon. Image index 0 should be the normal icon. Image 1 should be the mouse over icon and index 2 should be the moving/mouse click icon.
  • keepratio[true]: Whether to keep the same ratio for the sprite even if the object has a different ratio. Use this to make sure that your sprite doesn't get squished or stretched in a vertical or horizontal direction. The sprite will never be drawn outside the object.
  • color[c_white]: The color blend of the icon.
  • spraddto[0]: The amount to add to the image index of the sprite (if this would be 3 then image 3 would be used in place of image 0)
  • text[""]: What text do display underneath the icon. Below the text, a background is drawn.
  • textcolor[c_black]: The color of the text.
  • textselectcolor[c_black]: The color of the text when the icon is selected.
  • font[-1]: What font to use for the text. If -1 is used then the font is ignored.
  • keepinsidemode[1]: The mode to use to contain the icon. This is useful if you put this icon in a window or frame to make sure it doesn't get outside the view.
    • 0: for free swiping even outside the parent's area.
    • 1: for containing the icon inside the whole parent.
    • 2: for containing the icon inside the visible parts of the parent. (So disallow placement in parts where the parent is outside the parent's parent.)
  • onDoubleClick[-1]: This script will be executed whenever the user double clicks the swipicon. The first argument given to this script will be the instance id of the swipicon, while the second argument will be the value of onDoubleClickArgumnt.
  • onDoubleClickArgument[0]: What argument will be given to the onDoubleClick. This can be any value required by the onDoubleClick script.

This object has a background, and all it's associated variables about which you can learn more here These background values are different from the default:

  • margin_normal[5];
  • color_out[$efd8ba];

Readable variables

  • selected: If the object is selected.
  • hasmouse: If the icon is being moved. (Manually changing this value is discourages as it will give problems with the mouse being frozen)
  • update: same as hasmouse.
  • updated: Whenever the item is double clicked on. Only true for a single step after each double click.

Functions

  • uiz_swipicon_setcolor(instanceid,color[c_white]):
    • instanceid: the instance id of the instance you want to modify
    • color: The color blend of the icon.
  • uiz_swipicon_setsprite(instanceid,sprite[spr_uiZ_button],addtoimage[0],keepratio[true]):
    • instanceid: the instance id of the instance you want to modify
    • sprite: The sprite to use as the icon. Image index 0 should be the normal icon. Image 1 should be the mouse over icon and index 2 should be the moving/mouse click icon.
    • addtoimage: The amount to add to the image index of the sprite (if this would be 3 then image 3 would be used in place of image 0)
    • keepratio: Whether to keep the same ratio for the sprite even if the object has a different ratio. Use this to make sure that your sprite doesn't get squished or stretched in a vertical or horizontal direction. The sprite will never be drawn outside the object.
  • uiz_swipicon_settext(instanceid,text[""]):
    • instanceid: the instance id of the instance you want to modify
    • text[""]: What text do display underneath the icon. Below the text, a background is drawn.
  • uiz_swipicon_settextsettings(instanceid,color[c_black],selection color[c_black],font[-1]):
    • instanceid: the instance id of the instance you want to modify
    • textcolor[c_black]: The color of the text.
    • selection color[c_black]: The color of the text when the icon is selected.
    • font[-1]: What font to use for the text. If -1 is used then the font is ignored.
  • uiz_swipicon_keepinsidemode(instanceid,keepinside[1]):
    • instanceid: the instance id of the instance you want to modify
    • keepinsidemode[1]: The mode to use to contain the icon. This is useful if you put this icon in a window or frame to make sure it doesn't get outside the view.
    • 0: for free swiping even outside the parent's area.
    • 1: for containing the icon inside the whole parent.
    • 2: for containing the icon inside the visible parts of the parent. (So disallow placement in parts where the parent is outside the parent's parent.)
  • selected=uiz_swipicon_getselected(instanceid):
    • selected: If the object is selected.
    • instanceid: the instance id of the instance you want to modify
  • updated=uiz_swipicon_getdoubleclick(instanceid):
    • updated: Whenever the item is double clicked on. Only true for a single step after each double click.
    • instanceid: the instance id of the instance you want to modify
  • uiz_swipicon_onDoubleClick(instanceid, script, argument):
    • instanceid: the instance id of the instance you want to modify
    • script[-1]: This script will be executed whenever the user double clicks the swipicon. The first argument given to this script will be the instance id of the swipicon, while the second argument will be the value of onDoubleClickArgumnt.
    • argument[0]: What argument will be given to the onDoubleClick. This can be any value required by the onDoubleClick script.

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