View previous topic :: View next topic |
Author |
Message |
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Mon May 03, 2021 2:38 am Post subject: add a number / letter to a cememo |
|
|
how can i add a letter or number to cememo? example
CEMemo1.text = goodby
when u press button it add letter e to it so it becomes
CEMemo1.text = goodbye
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Mon May 03, 2021 3:56 am Post subject: |
|
|
Example :
Code: | if f then f.Destroy() end
f = createForm()
memo1 = createMemo(f)
memo1.Lines.Text = 'goodby'
btn = createButton(f)
btn.Left = memo1.Width + 20
btn.Caption = 'Press Me'
function addEtoMemo()
local mytext = 'e lover'
memo1.Lines.Text=memo1.Lines.Text..[[]]..mytext
end
btn.OnClick = addEtoMemo
f.show() |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Mon May 03, 2021 8:06 am Post subject: |
|
|
so i asked my friend for some help and he gave me this script with the example ct i gave him, does this work too?
Code: | function UDF1_CEButton1Click(sender)
UDF1.CEMemo1.Lines[0] = string.format("%s%s", UDF1.CEMemo1.Lines[0], "e")
end
|
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Mon May 03, 2021 8:49 am Post subject: |
|
|
HexaG0n wrote: | so i asked my friend for some help and he gave me this script with the example ct i gave him, does this work too?
Code: | function UDF1_CEButton1Click(sender)
UDF1.CEMemo1.Lines[0] = string.format("%s%s", UDF1.CEMemo1.Lines[0], "e")
end
|
|
Yes, if want append text/number at the end of specific memo lines.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Mon May 03, 2021 9:23 am Post subject: |
|
|
does it work for ceedit too? or is there another way for it to be used for ceedit
|
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Mon May 03, 2021 9:28 am Post subject: |
|
|
I think you forgot to mention that there is more than one line in "Memo" in your question.
Code: | if f then f.Destroy() end
f = createForm()
memo1 = createMemo(f)
memo1.Top=35
edt1 = createEdit(f) edt1.AutoSize=false
edt1.Left=5 edt1.Width=70
edt2 = createEdit(f) edt2.AutoSize=false
edt2.Left=90 edt2.Width=30
btn = createButton(f)
btn.Left = memo1.Width + 20
btn.Caption = 'Press Me'
local txt=[[Hello ther
Good by
I came again
I went
]]
memo1.Lines.Text=txt
edt1.Text="e"
edt2.Text="0"
function addEtoMemo()
local myline = tonumber(edt2.Text)
local cnt=memo1.Lines.Count -1
if myline>=cnt then showMessage("The specified line is empty or does not exist.Line: 0/"..cnt);
else
local mytext = edt1.Text
memo1.Lines[myline]=memo1.Lines[myline]..mytext
end
end
btn.OnClick = addEtoMemo
f.show() |
It shouldn't be difficult to apply them to your scenario.
Code: | --[[f=UDF1
memo1=UDF1.CEMemo1
edt1=UDF1.CEEdit1
etc
]] |
|
|
Back to top |
|
|
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Mon May 03, 2021 9:38 am Post subject: |
|
|
ohh i understand how it works now... thank you so much
|
|
Back to top |
|
|
|