DgsProgressBarSetMode: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function}} This function sets bar image showing mode. ==Syntax== <syntaxhighlight lang="lua"> element dgsCreateProgressBar ( float x, float y, float width, float h...")
 
 
(4 intermediate revisions by the same user not shown)
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
element dgsCreateProgressBar ( float x, float y, float width, float height, bool relative)
bool dgsProgressBarSetMode ( element progressBar, bool mode )
</syntaxhighlight>  
</syntaxhighlight>  
[[Image:dgspgMode.gif|frame|The Effect Of Mode.]]


===Required Arguments===  
===Required Arguments===  
[[Image:dgspgMode.gif|frame|Example dx progress bar.]]
*'''progressBar:''' the Progress Bar that you want to operate.
*'''x:''' A float of the 2D x position of the progress bar on a player's screen. This is affected by the ''relative'' argument.
*'''mode:''' the mode to choose ( see effect in the the right side image ).
*'''y:''' A float of the 2D y position of the progress bar on a player's screen. This is affected by the ''relative'' argument.
*'''width:''' A float of the width of the progress bar. This is affected by the ''relative'' argument.
*'''height:''' A float of the height of the progress bar. This is affected by the ''relative'' argument.
*'''relative:''' This is whether sizes and positioning are relative. If this is ''true'', then all x,y,width,height floats must be between 0 and 1.
===Optional Arguments===
{{OptionalArg}}
*'''parent:''' This is the parent that the DGS button is attached to.  If the ''relative'' argument is true, sizes and positioning will be made relative to this parent. If the ''relative'' argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning.
*'''bgimg:''' An image element of the background of the progress bar.
*'''bgcolor:''' An int of the color of the background of the progress bar.
*'''barimg:''' An image element of the background of the bar of the progress bar.
*'''barcolor:''' An int of the color of the background of the bar of the progress bar.
*'''barmode:''' A bool of the mode of the bar of progress bar. (true:the image of bar of progress bar will be relative ;false:the image of bar of progress bar will be absolute )


===Returns===
===Returns===
Returns [[element]] of the progress bar if it was created succesfully, ''false'' otherwise.
Returns ''true'' if succeed, ''false'' otherwise.
 
<section name="Client" class="client" show="true">
'''Example 1:'''


<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
DGS = exports.dgs
DGS = exports.dgs
progressbar = DGS:dgsCreateProgressBar(286, 307, 317, 43, false)  
local tex = dxCreateTexture("exampleImage.png")
number = 0
pb1 = DGS:dgsCreateProgressBar(100,300,400,50,false)
setTimer(function ()
DGS:dgsSetProperties(pb1,{barimg=tex,barcolor=tocolor(255,255,255,255)})
number = number + 1
pb2 = DGS:dgsCreateProgressBar(100,370,400,50,false)
DGS:dgsProgressBarSetProgress(progressbar,number)
DGS:dgsSetProperties(pb2,{barimg=tex,barcolor=tocolor(255,255,255,255)})
if number == 100 then
DGS:dgsProgressBarSetMode(pb2,true)
number = 0
addEventHandler("onClientRender",root,function()
end  
local tick = getTickCount()/20%360/180*math.pi
end,3000,0)
local pos = (math.cos(tick)*100+100)/2
DGS:dgsProgressBarSetProgress(pb1,pos)
DGS:dgsProgressBarSetProgress(pb2,pos)
end)
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{DGSFUNCTIONS}}
{{DGSFUNCTIONS}}

Latest revision as of 07:28, 11 February 2018

This function sets bar image showing mode.

Syntax

bool dgsProgressBarSetMode ( element progressBar, bool mode )
The Effect Of Mode.

Required Arguments

  • progressBar: the Progress Bar that you want to operate.
  • mode: the mode to choose ( see effect in the the right side image ).

Returns

Returns true if succeed, false otherwise.

DGS = exports.dgs
local tex = dxCreateTexture("exampleImage.png")
pb1 = DGS:dgsCreateProgressBar(100,300,400,50,false)
DGS:dgsSetProperties(pb1,{barimg=tex,barcolor=tocolor(255,255,255,255)})
pb2 = DGS:dgsCreateProgressBar(100,370,400,50,false)
DGS:dgsSetProperties(pb2,{barimg=tex,barcolor=tocolor(255,255,255,255)})
DGS:dgsProgressBarSetMode(pb2,true)
addEventHandler("onClientRender",root,function()
	local tick = getTickCount()/20%360/180*math.pi
	local pos = (math.cos(tick)*100+100)/2
	DGS:dgsProgressBarSetProgress(pb1,pos)
	DGS:dgsProgressBarSetProgress(pb2,pos)
end)

See Also

Custom Cursor Functions

Multi Language Supports

Animation

3D Element

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips