thisdp / dgs Goto Github PK
View Code? Open in Web Editor NEWThisdp's Dx Graphical User Interface System (MTA Dx Lib)
Home Page: http://wiki.mtasa.com/wiki/dgs
Thisdp's Dx Graphical User Interface System (MTA Dx Lib)
Home Page: http://wiki.mtasa.com/wiki/dgs
Line 273 in fucntions.lua
if not dgsElementData[p].visible then return false end
p doesn't exist as if it does the loop will break
Not sure what the idea is of that code but I changed it to
if dgsElementData[p] and not dgsElementData[p].visible then return false end
To make it work
test
Hi
i have a trouble with dgs
i used dgs to a custom chat and when i'm trying to write after a turn on writing, dgs is "blocked" and i cant write
i'm using dgs to a loginpanel and everything is ok, only in custom chat is problem
Line of creating :
typing_message=exports.dgs:dgsCreateEdit((28/1920)*s.x, (348/1080)*s.y, (277/1920)*s.x, (30/1080)*s.y,"",false,false,tocolor(0,0,0,255),1,1,false,tocolor(0,0,0,0))
turn on writing
addEventHandler("onClientKey",root,function(button,state)
if button=="t" and not state and not typing then
toggleAllControls(false)
exports.dgs:dgsSetVisible(typing_message,true)
exports.dgs:dgsFocus(typing_message)
exports.dgs:dgsSetFont(typing_message,font_dgs)
exports.dgs:dgsSetText(typing_message,"")
typing=true
showCursor(false)
and when i taped "t", i cant write in this edit
not always, 50/50, one time i can and one time i cant
i use this version
https://community.multitheftauto.com/index.php?p=resources&s=details&id=14420
i dont wanna to update to latest version, because size of text in edit in new version dont working in dgsCreateEdit
As the title says, I am unable to create memo with relative size, but I fixed my problem with one line of code added at line 55 in file core/memo.lua. I'd create pull request but I don't know how can I do that.
local renderTarget = dxCreateRenderTarget(abx-4,aby,true)
on Core/gridlist.lua: 530 the function will return an error because additionalLenght is not defined, it is also not in assert.
Also relative doesn't seem to do anything, an leaving it at false just destroys the column size.
dgsDxGridListGetSelectedItem is used to get the value of a selected item in grid list, but even if nothing is selected, it returns a value.
Example:
local myItem = dgsDxGridListGetSelectedItem(gridList)
if (myItem) then -- It will always be this
outputDebugString("Something was selected.", 3)
else
outputDebugString("Nothing is selected.", 3)
end
So you cannot check if a player did not select anything yet.
Hi, do you have any plans to implement a system for automatic layout of GUI components? Here are some examples of the idea from GUI toolkits in other languages:
What do you think about it? Could such layouting concept land in the DGS? I think it would be a great feature and would speed up GUI development a bit but it would probably take some good amount of time to implement it well.
On the nightly that did this change to the textures something broke in DGS. No debug message appears, but I am unable to close any window or even move them correctly.
In r20762 it works just fine. I didn't test other versions, but I suspect that this or probably this broke DGS.
Video about the issue: https://youtu.be/OvjEY4L7khI
If it can't be fixed due to being a problem with MTA I could make an issue about it, but I didn't take the time to dissect the problem or read the DGS code.
EDIT: The bug starts happening on r20765. I think it's related to the editbox since DGS brakes after seeing one afaik.
local btn = dgsCreateButton(0.15, 0.2, 0.3, 0.2, "A simple button", true)
dgsSetProperties(
btn,
{
["iconImage"] = ":ThisResource/Files/SomeImage.png",
}
)
The first problem is that dgs won't load the image if you simply use relative path to current resources files, e.g ("File/Images/SomeImage.png")
and the second one works but if you change the file server-side and restart that resource, the texture won't get updated
Solution:
Maybe we can attach an event handler with onClientResourceStart/Stop
when a file get's loaded from that resource and reload the textures loaded from that resource into dgs
When using OOP all elements are always postGUI TRUE, even using :setPostGUI(false). POP version (dgsSetPostGUI) works fine.
I'm using wiki OOP window example, adding :setPostGUI(false)
loadstring(exports.dgs:dgsImportOOPClass(true))()-- load OOP class
window = dgsWindow(0,0,0.5,0.1,"test",true):setPostGUI(false) --create a window with oop
label = window:dgsLabel(0,0,1,1,"label",true) --create a label inside the window ( Correct )
label.text = "DGS OOP Test" --set text
Line 128 in d1e1f68
remove that ^
If you create a gridlist and give it alot of columns so it has scroll bars, then use dgsGridListClear
on it, the gridlist is cleared.
After this if you add items into the gridlist again, they will no longer have scroll bars.
These lines clear the scrollbars completely so they do not exist anymore even if it is needed.
Line 564 in 62bc516
Line 566 in 62bc516
nevermind, issue to delete
dgs/Core/customCursor.lua
Line 14
Fix
From:
local texture = dgsCreateTextureFromStyle(_,_style[k].image)
To:
local texture = dgsCreateTextureFromStyle(using, res, style[k].image)
local DGS = exports.dgs
button = DGS:dgsCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true )
Can you check this function: dgsGridListSetItemText?Just standart guiGridListSetItemText works with this script, but dgsGridListSetItemText doesn't
[2018-01-24 14:55:11] ERROR: dgs\Core\gridlist.lua:444: attempt to index field '?' (a nil value)
[2018-01-24 14:55:11] ERROR: [DayZ-MTA][system][addons]\addons_building\client.lua:91: call: failed to call 'dgs:dgsGridListSetItemText' [string "?"]
When setting the color to 255, 255, 255 in a HLDisk you can not change the color anymore (besides darker shade of white only)
255, 255, 254 works
performancebrowser says DGS have a high cpu using
topic
Hello, I just want to point out and also ask how should I delete all ELEMENTS when DGS elements are deleted using destroyElement but the KB still remains in Lua Memory, for example, in a few windows it is added but then deleted again, but after spamming the given script, the MTA subsequently crashes and or the images (dxCreateTexture) or (dgsCreateImage) are not shown at first, so after spamming that script, they do not show after a while and become white, and then the MTA client crashes. I'm asking for help on how to improve this and make it so that all elements are removed, I'm using the mod for RolePlay, more precisely OWLGAMING 2020, which is almost entirely redone by Odem and another scripter and is also de facto completely changed to DGS, so as I say please help or simply how to remove that save from DGS.
Basically if we set setCursorAlpha to 0, dgs automatically sets the cursor alpha back to maximum, it happens only if dgs is active.
version: 3.52
I'm a fan of the DGS Selector. It would be nice to have the following behavior (can be enabled via a dgs-dxselector property):
How /updatedgs should work in my opinion:
How it works at the moment:
Reproduce:
local window = dgsCreateWindow(.....)
dgsSetProperty(window, "dontClose", true)
addEventHandler("onDgsWindowClose", root,
function()
local dontClose = dgsGetProperty(source, "dontClose")
if (dontClose) then
cancelEvent()
dgsAlphaTo(source, 0.0, "Linear", 350)
setTimer(function(elem)
dgsSetVisible(elem, false)
dgsSetAlpha(elem, 1.0)
end, 750, 1, source)
end
end
)
Try to close the window, it will close and the animation works.
But when you set window visible to true again and try to close it, it won't trigger and won't close
Hello, I have a problem after the DGS update, nothing is displayed, no errors in db3.
Would be nice to have guiGridListClear.
Currently, you can control itemTextPadding, which appears to work as it offsets the item text from the left. However, I wasn't able to increase the spacing between items. As you can see in the screenshot, I'm using a rather big font so the item texts touch each other, and it could use some spacing.
Hi there, I really liked the project since the first time I stumbled upon it a while back. I also love the fact that it is still under active development ๐ Sadly there is almost no chance for me to use DGS because of the license which requires me to disclose source code of any program which would use it. Is there any chance for re-license or dual-license under less restrictive terms?
them i apply the code :
DGS:dgsSetVisible( Edit, false )
DGS:dgsFocus(image1)
DGS:dgsSetEnabled ( Edit, false )
disappears correctly but cursor still on screen. only clicking somewhere the cursor show off.
Who can i do to cursor show off with the dgsSetVisible false.
another thing is if i m in car doing this the edit box dont type the letters
DGS while idle runs dgsCoreRender
every frame. This should be unnecesary, since no DGS elements are on screen or even loaded.
You can check this by opening a clean server, starting DGS and IPB and search Lua timing (option d).
This should not be the case. Unless there is a DGS element created or something like debugdgs
enabled, there should be no onClientRender
or onClientPreRender
functions running. They should be added after a DGS element has been created, or even better, when a DGS element is being rendered. This will make DGS perform MUCH better while is not loaded.
On high FPS it can lead for up to 1.5% CPU usage (AMD Ryzen 5 2600 on Windows 10), while on low FPS it gets like 0.4-0.5% CPU usage.
Hello, can you add this function https://wiki.multitheftauto.com/wiki/GuiGridListGetSelectedItems ?
The problem:
When I create a small circular progress bar, the edges are not smooth.
Code to produce the bug:
dgsSetProperty(progressBar,"bgColor", tocolor(0, 0, 0, 255))
dgsProgressBarSetStyle(progressBar,"ring-round")
local progress = 0
addEventHandler("onClientRender", root,
function()
dgsProgressBarSetProgress(progressBar,progress)
progress = progress + 0.1
end)
I had to put ":resource/image.png" for him to take my image and put it in "dgsCreate3DImage"
Image already created
https://imgur.com/a/kc6jaBN
Error Image
https://imgur.com/a/fcX4ehC
DGS = exports.dgs
local image = DGS:dgsCreate3DImage(0, 0, 4, "test.png",tocolor(255,255,255,255), 20, 20)
DGS:dgsSetProperty(image,"fadeDistance",20)
DGS:dgsSetProperty(image,"outline",{"out",1,tocolor(255,255,255,255)})
DGS:dgs3DImageAttachToElement(image,localPlayer,0,5)
DGS = exports.dgs
local image = DGS:dgsCreate3DImage(0, 0, 4, ":test/test.png",tocolor(255,255,255,255), 20, 20)
DGS:dgsSetProperty(image,"fadeDistance",20)
DGS:dgsSetProperty(image,"outline",{"out",1,tocolor(255,255,255,255)})
DGS:dgs3DImageAttachToElement(image,localPlayer,0,5)
dgs/plugin/Gradient/gradient.lua
Line 20 in f6e2dc3
assert(type(colorFrom) == "number","Bad argument @dgsGetGradientColor at argument 2, expect number got "..type(color1))
assert(type(color2) == "number","Bad argument @dgsGetGradientColor at argument 3, expect number got "..type(color2))
function dgsGradientSetColor(gradShader,colorFrom,colorTo)
assert(dgsGetPluginType(gradShader) == "dgs-dxgradient","Bad argument @dgsGradientSetColor at argument 1, expect dgs-dxgradient got "..type(gradShader))
assert(type(colorFrom) == "number","Bad argument @dgsGetGradientColor at argument 2, expect number got "..type(colorFrom))
assert(type(colorTo) == "number","Bad argument @dgsGetGradientColor at argument 3, expect number got "..type(colorTo))
dgsSetData(gradShader,"colorFrom",colorFrom)
dgsSetData(gradShader,"colorTo",colorTo)
dxSetShaderValue(gradShader,"colorFrom",{fromcolor(colorFrom,true,true)})
dxSetShaderValue(gradShader,"colorTo",{fromcolor(colorTo,true,true)})
return true
end
If you dgsMemoSetReadOnly(memo, true)
the memo becomes read only.
After this, if you dgsMemoSetReadOnly(memo, false)
you still cannot write in the memo.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.