Jump to content

Transparent Editbox


Bonsai

Recommended Posts

Hi,

is there already a way to make the default gui editboxes transparent?

It seems to always have a white background, which doesn't look so good if they are used within a dx environment.

If not, then this might be a good way to make the default editboxes usable outside of an actual gui window.

@ccw :P

Bonsai

Link to comment
20 hours ago, Tails said:

You can set the alpha property with setProperty:


local edit = GuiEdit(200, 200, 200, 30, '', false)
edit:setProperty('Alpha', 0.5)

 

I tried guiSetAlpha( edit, 0 ) already.

But this makes everything invisible, not just the white background. 

So you can't even see the text anymore.

Basically only the white background needs to be transparent.

Link to comment

u use a dxDraw interface right?

then just create a guiEdit make alpha 0 and draw it with dxDrawText

 

like this:

text = guiCreateEdit(0.48, 0.47, 0.12, 0.02, "", true)
setElementAlpha(text,0)
dxDrawText( guiGetText(text) ,0.48, 0.47, 0.12, 0.02, tocolor(150, 150, 150,250), 1, segoeui, 'left', 'center')

but u need 2 eventHandlers for that - need to render (onClientRender) dxDraw and do not need to render guiCreateEdit
So create a Event and trigger it once, after remove EventHandler (onClientRender) u need to destroy guiElement

Edited by xFFrozen
Link to comment
10 hours ago, xFFrozen said:

u use a dxDraw interface right?

then just create a guiEdit make alpha 0 and draw it with dxDrawText

 

like this:


text = guiCreateEdit(0.48, 0.47, 0.12, 0.02, "", true)
setElementAlpha(text,0)
dxDrawText( guiGetText(text) ,0.48, 0.47, 0.12, 0.02, tocolor(150, 150, 150,250), 1, segoeui, 'left', 'center')

but u need 2 eventHandlers for that - need to render (onClientRender) dxDraw and do not need to render guiCreateEdit
So create a Event and trigger it once, after remove EventHandler (onClientRender) u need to destroy guiElement

I actually tried this some time ago!

The fonts sizes didn't match so it looked weird the longer the text in the editbox got.

 

9 hours ago, thisdp said:

If you really want a dx lib, I am glad to recommend you my dgs(dx gui framework)

I have actually downloaded and tried this framework some month ago.

It seems to work pretty good but I usually don't like to use external resources.

I might have to use the default mta gui for now and change it to something more fancy looking later.

  • Like 2
Link to comment
  • 3 weeks later...
  • Scripting Moderators

Now your problem is solved by DGS.

If you have DGS, then

loadstring(exports.dgs:dgsImportFunction())()

edit = dgsCreateEdit(0.3,0.4,0.2,0.05,"test",true)
dgsSetProperty(edit,"bgcolor",tocolor(255,255,255,0))

 

  • Like 1
Link to comment
On 10.5.2018 at 17:44, thisdp said:

Now your problem is solved by DGS.

If you have DGS, then


loadstring(exports.dgs:dgsImportFunction())()

edit = dgsCreateEdit(0.3,0.4,0.2,0.05,"test",true)
dgsSetProperty(edit,"bgcolor",tocolor(255,255,255,0))

 

Hey,

Thank you! I will try this out! The main reason why I decided to use the default MTA Gui in my Multigamemode is because of the editboxes.

If this works good then I can change it so it will probably look much better!

  • Like 1
Link to comment
  • Scripting Moderators
6 hours ago, Bonsai said:

Hey,

Thank you! I will try this out! The main reason why I decided to use the default MTA Gui in my Multigamemode is because of the editboxes.

If this works good then I can change it so it will probably look much better!

Thanks for your supports.

DGS edit doesn't supports arabic read style, but it will be added soon. Except for this, all things function. Text selection, other language and color and so on

Edited by thisdp
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...