Skip to content
Thomas edited this page Aug 28, 2020 · 6 revisions

obj_uiZ_frame

This is one of the most basic objects in uiZ. It is made to give structure to your ui objects. It is like an invisible object (with a few more caveats). This is very usefull if you just want to create a canvas to put your objects in.

The frame can be used for basic stuff, but has some advanced features to enable scrolling of frames. The scrolling can happen trough:

  • Mouse swipe movement.
  • Mouse scroll wheel movement.
  • Mouse scroll wheel press and mouse movement.
  • Scrollbars.(By default only enabled if on a non-touchscreen device.)

When setting up scrolling, it is important to fix the children before fixing the frame itself. The frame needs to know how far it can scroll, it checks this during fixing. If it wants to check this correctly though, it needs to know the size and position of all objects inside. (And thus they need to be fixed)

This object also react slightly different to the global mouse variables compared to other uiz objects. Here's how that works:

  • global.mouseoverobject: Gives the instance id of what object the mouse is over but leaves out any frames.
  • global.mouseoverframe: Gives the instance id of what frame the mouse is over but leaves out any other objects. (counts for obj_uiZ_frame, obj_uiZ_slideframe, obj_uiZ_windowholder and obj_uiZ_surfaceholder).
  • global.mouseover: Gives the instance id of whatever uiz object the mouse is on.

Property variables

  • mark[false]: marks the frame with a color. (useful for debugging)
  • markcolor[random color]: The color to mark the frame with if mark==true.
  • debugmark[false]: Draw a square (with the color of markcolor) at the positions of the frame for debug purposes. Also displays the frame's instance id.
  • scrolly[false]: Enable scroll features on the frame in the vertical direction. (for a list of scroll features, look at the top of this page)
  • scrollx[false]: Enable scroll features on the frame in the horizontal direction. (for a list of scroll features, look at the top of this page)
  • scrollyspeed[30]: Amount of pixels scrolled when scrolling vertically either by using the scrollwheel or a button on the scrollbar.
  • scrollxspeed[30]: Amount of pixels scrolled when scrolling horizontally either by using the scrollwheel or a button on the scrollbar.
  • scrollbary[!global.systemsupportstouch]: Whether to enable the vertical scrollbar. By default only on when the current platform doesn't support touch. Only has effect when scrolly==true.
  • scrollbarx[!global.systemsupportstouch]: Whether to enable the horizontal scrollbar. By default only on when the current platform doesn't support touch. Only has effect when scrollx==true.
  • autoupdatescrolly[false]: Whether to automatically check the amount that the frame is able to scroll vertically every step. If this is false you will need to "fix" the frame once after changing any object (or a set of objects at once) in the frame. May be performance intensive depending on the amount of objects in the frame.
  • autoupdatescrollx[false]: Whether to automatically check the amount that the frame is able to scroll horizontally every step. If this is false you will need to "fix" the frame once after changing any object (or a set of objects at once) in the frame. May be performance intensive depending on the amount of objects in the frame.
  • scrollbarsize[0.2]: The width both horizontal and vertical bars should have.
  • scrollbarsizetype[dp]: The width type both horizontal and vertical bars should have.
  • scrollbarsprite[spr_uiZ_scrollbar]: The sprite to use for the scrollbar. (See obj_uiZ_scrollbar for more information.)
  • scrollbarcolor[c_white]: which color blend the sprite should get.(may not apply to all parts)
  • scrollbacktexturemode[uiz_texturemode_fill]: How sprites should be stretched/tiled. You can choose the constants:
    • uiz_texturemode_fill
    • uiz_texturemode_fill_edgeless
    • uiz_texturemode_tile
    • uiz_texturemode_tilefit.

Functions

  • uiz_frame_mark(instanceid,mark,markcolor):

    • instanceid: the instance id of the instance you want to modify
    • mark[false]: marks the frame with a color. (useful for debugging)
    • markcolor[random color]: The color to mark the frame with if mark==true.
  • uiz_frame_debugmark(instanceid,debugmark,markcolor):

    • instanceid: the instance id of the instance you want to modify
    • debugmark[false]: Draw a square (with the color of markcolor) at the positions of the
    • markcolor[random color]: The color to mark the frame with if mark==true.
  • uiz_frame_setscrollable(instanceid,scrollx,scrolly):

    • instanceid: the instance id of the instance you want to modify
    • scrollx[false]: Enable scroll features on the frame in the horizontal direction. (for a list of scroll features, look at the top of this page)
    • scrolly[false]: Enable scroll features on the frame in the vertical direction. (for a list of scroll features, look at the top of this page)
  • uiz_frame_setscrollspeed(instanceid,scrollxspeed,scrollyspeed):

    • instanceid: the instance id of the instance you want to modify
    • scrollxspeed[30]: Amount of pixels scrolled when scrolling horizontally either by using the scrollwheel or a button on the scrollbar.
    • scrollyspeed[30]: Amount of pixels scrolled when scrolling vertically either by using the scrollwheel or a button on the scrollbar.
  • uiz_frame_setscrollbar(instanceid,scrollbarx,scrollbary):

    • instanceid: the instance id of the instance you want to modify
    • scrollbarx[!global.systemsupportstouch]: Whether to enable the horizontal scrollbar. By default only on when the current platform doesn't support touch. Only has effect when scrollx==true.
    • scrollbary[!global.systemsupportstouch]: Whether to enable the vertical scrollbar. By default only on when the current platform doesn't support touch. Only has effect when scrolly==true.
  • uiz_frame_setscrollbarsettings(instanceid,scrollbarsize,scrollbarsizetype,scrollbarsprite,scrollbarcolor,scrollbacktexturemode):

    • instanceid: the instance id of the instance you want to modify
    • scrollbarsize[0.2]: The width both horizontal and vertical bars should have.
    • scrollbarsizetype[dp]: The width type both horizontal and vertical bars should have.
    • scrollbarsprite[spr_uiZ_scrollbar]: The sprite to use for the scrollbar. (See obj_uiZ_scrollbar for more information.)
    • scrollbarcolor[c_white]: which color blend the sprite should get.(may not apply to all parts)
    • scrollbacktexturemode[uiz_texturemode_fill]: How sprites should be stretched/tiled. You can choose the constants:
      • uiz_texturemode_fill
      • uiz_texturemode_fill_edgeless
      • uiz_texturemode_tile
      • uiz_texturemode_tilefit.
  • uiz_frame_setscrollautoupdate(instanceid,autoupdatescrollx,autoupdatescrolly):

    • instanceid: the instance id of the instance you want to modify
    • autoupdatescrollx[false]: Whether to automatically check the amount that the frame is able to scroll horizontally every step. If this is false you will need to "fix" the frame once after changing any object (or a set of objects at once) in the frame. May be performance intensive depending on the amount of objects in the frame.
    • autoupdatescrolly[false]: Whether to automatically check the amount that the frame is able to scroll vertically every step. If this is false you will need to "fix" the frame once after changing any object (or a set of objects at once) in the frame. May be performance intensive depending on the amount of objects in the frame.

Visuals

Here is the example code that created this image:

win=uiz_window_create(250,px,100,px)
uiz_fixgeneralpos(win);

f=uiz_c(obj_uiZ_frame);
uiz_setParent(f,win);
f.posinframex=uiz_fill;
f.posinframey=uiz_fill;
uiz_frame_setscrollable(f,true,true);


o=uiz_c(obj_uiZ_easybutton);
uiz_setParent(o,f);
o.posinframex=uiz_snapleft;
o.posinframey=uiz_snaptop;
o.posvalwtype=px;
o.posvalhtype=px;
o.posvalw=500;
o.posvalh=500;

//it is important to fix the button before fixing the frame
//the frame needs to know how far it can scroll. It checks this during fixing. If it wants to check this correctly though, it needs to know the size and position of all objects inside. (And thus they need to be fixed)
uiz_fixgeneralpos(o);
uiz_fixgeneralpos(f);

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