View previous topic :: View next topic |
Author |
Message |
Razi Expert Cheater Reputation: 1
Joined: 17 Jan 2018 Posts: 202
|
Posted: Wed Mar 01, 2023 1:13 pm Post subject: How to display the name of the controls on focus? |
|
|
How to display the name of the controls on focus? Example: the trainer has 1000 controls, Edit boxes, Checkboxes, Buttons, etc. How to display name of the control when the control is clicked or focused?
Also, how to display Label, Progressbar, Panel, GroupBox name? |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
|
Back to top |
|
|
Razi Expert Cheater Reputation: 1
Joined: 17 Jan 2018 Posts: 202
|
Posted: Thu Mar 02, 2023 8:25 am Post subject: |
|
|
Corroder wrote: | I hope you gave the name for all components on your form already. |
Yes, the components are created in the form designer.
Corroder wrote: | If yes the look at example script below. |
This is almost exactly what I need. But, I need if the component is in focus, then display its name via print().
This code below works, but is there a way to display the name without the timer?
Code: | function getCtlName()
for i = 0, UDF1.ControlCount - 1 do
if UDF1.Control[i].focused() then
local compName = UDF1.Component[i].Name
print(compName)
end
end
end
function CETimer1Timer(sender)
getCtlName()
end |
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Thu Mar 02, 2023 8:33 am Post subject: |
|
|
WinControl descendants have an OnEnter and OnExit property
OnEnter is called when they gain control, OnExit when the focus is lost _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Thu Mar 02, 2023 8:43 am Post subject: |
|
|
e.g:
Code: |
function setOnEnter(c, f)
c.OnEnter=f
if c.ControlCount then
for i = 0, c.ControlCount - 1 do
setOnEnter(c.Control[i], f)
end
end
end
setOnEnter(UDF1, function(s)
print(s.Name.." has focus")
end)
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Razi Expert Cheater Reputation: 1
Joined: 17 Jan 2018 Posts: 202
|
Posted: Thu Mar 02, 2023 10:21 am Post subject: |
|
|
Dark Byte wrote: | e.g:
Code: | function setOnEnter(c, f) |
|
Thanks, this helped. |
|
Back to top |
|
|
|