-
Notifications
You must be signed in to change notification settings - Fork 2
Object_scrollbar
To see a minimal example of a scrollbar in your own object, see scrollbar object template
To draw a scrollbar you need three things:
- use the scrollbar version of the uiz_mouse_docheck() script in the User Defined 1 event, which is uiz_mouse_docheck_scrollable().
- call uiz_drawscrollbar_xxx_step from User Defined 7.
- call uiz_drawscrollbar_xxx_draw from your draw event, which is User Defined 0.
- initialize the scrollbar using uiz_drawscrollbar_init in a create event.
When using the scrollbar functions you will often see a "scroll" argument or return value. The scroll variable holds the state of the scrollbar. It holds how far the scrollbar has scrolled, what buttons are pressed and much more. You need to init it in a create event. You don't need to destroy it as it's a game maker array which is automatically destroyed.
-
uiz_drawscrollbar_deselect(x1, y1, x2, y2, orientation, scroll): Deselects a certain scrollbar. The scrollbar is selected when the user moves it with the mouse. This function also updated the view of the scrollbar, you don't need to update/redraw the object manually. This script takes a scrollbar and removes any state involving the mouse. his should be called whenever the mouse used to be on the object but now isn't anymore. (Call in User Defined 2 when kmouseover == 0)
- x1: The x coordinate of the left side of your scrollbar.
- y1: The y coordinate of the top side of your scrollbar.
- x2: The x coordinate of the right side of your scrollbar.
- y2: The y coordinate of the bottom side of your scrollbar.
- orientation: If you scrollbar is horizontal or vertical. Set to uiz_horizontal or uiz_vertical.
- scroll: The current scrollbar state.
-
isSelected = uiz_drawscrollbar_getSelected(scroll): Returns whether the mouse has grabbed the scrollbar.
- isSelected: Whether the mouse has grabbed the scrollbar.
- scroll: The current scrollbar state.
-
scrollValue = uiz_drawscrollbar_getValue(scroll):
- scroll: How many units the scrollbar has scrolled. This is a number between 0 and the "scrollLines" argument given to the _step function.
- scroll: The current scrollbar state.
-
uiz_drawscrollbar_horizontal/vertical_step(x1, y1, x2, y2, scroll, scrollLines, middleMouseScroll, scrollSpeed, animation, animationTime): Place this function in the User Defined 7 event. There exists both a horizontal and vertical version of this function.
- x1: The x coordinate of the left side of your scrollbar.
- y1: The y coordinate of the top side of your scrollbar.
- x2: The x coordinate of the right side of your scrollbar.
- y2: The y coordinate of the bottom side of your scrollbar.
- scroll: The current scrollbar state.
- scrollLines: How many steps the scrollbar has. If you're drawing out a list, then this would be: (your list size)-(how many list items fit on my object without scrolling).
- middleMouseScroll: A bool value whether you want scrolling to be enabled.
- scrollSpeed: how many scrollLines the middle mouse scroll wheel and/or the buttons should scroll every time you interact with them.
- animation: What animation type should be used when scrolling the scroll wheel by using the middle mouse button and/or the scroll buttons.
- animationTime: How long the previously mentioned animation should take.
-
uiz_drawscrollbar_horizontal/vertical_draw(x1, y1, x2, y2, scrollbarSprite, scrollbarColor, scrollbarBackTextureMode, scroll, scrollLines):
- x1: The x coordinate of the left side of your scrollbar.
- y1: The y coordinate of the top side of your scrollbar.
- x2: The x coordinate of the right side of your scrollbar.
- y2: The y coordinate of the bottom side of your scrollbar.
- scrollbarSprite: What sprite to use for your scrollbar. To get the specifications for this, see obj_uiZ_scrollbar.
- scrollbarColor: What color blend the scrollbar should have.
- scrollbarBackTextureMode: What texturemode to use to draw the scrollbar. You can choose the constants: uiz_texturemode_fill, uiz_texturemode_fill_edgeless, uiz_texturemode_tile, uiz_texturemode_tilefit.
- scroll: The current scrollbar state.
- scrollLines: How many steps the scrollbar has. If you're drawing out a list, then this would be: (your list size)-(how many list items fit on my object without scrolling).
-
scroll = uiz_drawscrollbar_init(): Initialize a scrollbar. Put this in your create event.
- scroll: Returns an array structure used for drawing and manipulating scroll bars.
-
isAnimating = uiz_drawscrollbar_isAnimating(scroll): Get if a scrollbar is currently within an animation.
- isAnimating: If a scrollbar is currently within an animation (true or false).
- scroll: The current scrollbar state.
-
uiz_drawscrollbar_setValue(scroll, newValue): Changes how far a scrollbar has scrolled inside a scrollbar's "scroll" value. The change is instant, without animation. Don't forget to call uiz_drawscrollbar_update to make sure the scrollbar displays the right values.
- scroll: The current scrollbar state.
- newValue: Set newValue to the amount you want the scrollbar to be scrolled. Should be 0 or higher and lower than the "scrollLines" argument in uiz_drawscrollbar_.
-
uiz_drawscrollbar_setValue_animation(scroll, newValue, animation): Changes how far a scrollbar has scrolled inside a scrollbar's "scroll" value. The change is not instant, but uses an animation. Don't forget to call uiz_drawscrollbar_update to make sure the scrollbar displays the right values.
- scroll: The current scrollbar state.
- newValue: Set newValue to the amount you want the scrollbar to be scrolled. Should be 0 or higher and lower than the "scrollLines" argument in uiz_drawscrollbar_.
- animation: This needs to be set equal to the "animation" argument in uiz_drawscrollbar_horizontal/vertical_step.
-
uiz_drawscrollbar_update_mark(scroll): Marks a scrollbar for update without actually updating its view yes. this is useful if you know you have to update an area of an object that includes the scrollbar. Doesn't always update the entire scrollbar, only some parts that may have changed. The actual redrawing happens inside the _step function.
- scroll: The current scrollbar state.
-
uiz_drawscrollbar_update_mark_full(scroll): Marks a scrollbar for update without actually updating its view yes. this is useful if you know you have to update an area of an object that includes the scrollbar. This function will make sure the entire area of the scrollbar will get updated, instead of only the buttons that have changed. The actual redrawing happens inside the _step function.
- scroll: The current scrollbar state.
-
uiz_drawscrollbar_update_full(scroll, x1, y1, x2, y2): Directly schedules updates the view of a scrollbar.
- scroll: The current scrollbar state.
- x1: The x coordinate of the left side of your scrollbar.
- y1: The y coordinate of the top side of your scrollbar.
- x2: The x coordinate of the right side of your scrollbar.
- y2: The y coordinate of the bottom side of your scrollbar.
πTutorials
Basics 1: Basic positioning
Basics 2: Parenting system
Basics 3: Advanced positioning
Basics 4: Advanced sizing and set point
Basics 5: Canvas and containment
Basics 6: Alpha and depth
Basics 7: Using the manual and Animations
Basics 8: Object backgrounds
Basics 9: Grids
Basics 10: Framesets
Basics 11: Windows
Basics 12: Scroll bars
βοΈ Positioning
π Depth
π 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
π Strings
uiz_addChar
uiz_changechar
uiz_charCanHaveAddon
uiz_returnCharAddon
uiz_charIsNumber
uiz_charIsNumberOrText
uiz_getlines
uiz_gettext_contained
uiz_gettextlines_contained
uiz_getValidVariableName
uiz_isSpaceChar
uiz_lastStringChars
uiz_removeChar
uiz_replaceChars_
uiz_string_copy
uiz_string_digits
uiz_string_format
uiz_string_fromReal
uiz_string_real_getFracLength
uiz_string_real_getIntLength
uiz_string_repeat
uiz_string_replace
uiz_string_pos_at
uiz_stringUntilNewline