View previous topic :: View next topic |
Author |
Message |
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Sun May 05, 2019 6:07 am Post subject: Edit box control |
|
|
Hi, there
Say I have :
Code: | DisplayBox = createEdit(form)
DisplayBox.AutoSize = false
DisplayBox.setPosition(5,5)
DisplayBox.setSize(335,40)
DisplayBox.BorderStyle = 'bsNone'
DisplayBox.Color = '14481663'
DisplayBox.Font.Size = 20
DisplayBox.Text = ''
DisplayBox.Alignment = 'taRightJustify'
DisplayBox.ReadOnly = true
|
With edit box set Read Only = true, the user can't be typing anything to the edit box. This is like I want.
But, how I avoid the "flashing cell' and avoid the user block text on the edit box ?.
Thanks
Description: |
|
Filesize: |
28.29 KB |
Viewed: |
1538 Time(s) |
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sun May 05, 2019 6:18 am Post subject: |
|
|
I don't mess with the Lua GUI stuff in CE. But in other languages I tend to get around this kind of thing by making a label look like an text box; thus just modify the border, margins, and padding to look like a text box (some times it needs to be nested inside a panel/canvas to look right). I usually make a class that inherits from label or panel/canvas, with CE Lua you could probably make a sort of "createLebelBox" function.
_________________
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Sun May 05, 2019 7:52 am Post subject: |
|
|
May steal focus to another focusable ui when target ui got focused (event OnEnter).
Code: |
...
UDF1.CEEdit1.OnEnter = function(me)
UDF1.CEEdit2.Text = "Don't touch "..(me.Name or tostring(me))
UDF1.CEEdit2.SetFocus()
end
...
|
focusable ui seems only limited to certain type, like edit, button but not label.
And they have to be visible and enabled.
To make it not visible, set its position outside form boundary.
Negative position seems not work, ie setPosition(-100,-100) not ok, setPosition(1000,1000) ok.
CEEdit1 may still got focus when the form 1st time show if it is the first focusable ui, run UDF1.CEEdit2.SetFocus() before form show.
Empty UDF1.CEEdit2.Text and set readonly if it is suppose to be invisible.
_________________
- Retarded. |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Mon May 06, 2019 3:50 am Post subject: |
|
|
Thanks, Panraven. I tried your method for CEEdit2. It seems to work by 'hiding' CE Edit2 out of form boundary. Nice trick...
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
|