View previous topic :: View next topic |
Author |
Message |
Game Hacking Dojo Master Cheater
Reputation: 1
Joined: 17 Sep 2023 Posts: 250
|
Posted: Thu Nov 21, 2024 8:49 am Post subject: Form Wide Hotkey |
|
|
I am creating a form that I want to close by pressing VK_ESCAPE no matter the currently focused UI element.
This approach will only work if the focused UI element is the form
Code: | form.OnKeyDown = function(sender, key) if key == VK_ESCAPE then form.close() end end |
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25796 Location: The netherlands
|
Posted: Thu Nov 21, 2024 2:50 pm Post subject: |
|
|
Easiest way is have a button on the form with the Cancel property set to true but the button will have to be visible
you could maybe hook the wndproc using executeCodeLocalEx and handle the message loop manually
or give every control that can get a keyboard focus an onkeydown handler
_________________
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 |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1522
|
Posted: Thu Nov 21, 2024 5:28 pm Post subject: |
|
|
Code: | UDF1.Show()
if clTmr1 then clTmr1.Destroy() clTmr1=nil end
clTmr1 = createTimer()
clTmr1.Interval=100
clTmr1.OnTimer=function()
if isKeyPressed(VK_ESCAPE) then
clTmr1.Destroy()
UDF1.Close()
--closeCE()
--return cafree
end
collectgarbage("count")
end
clTmr1.Enabled=true |
_________________
|
|
Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Fri Nov 22, 2024 1:39 am Post subject: |
|
|
The hotkey in a memory record seems work even ce not in focus.
test memory record, paste following in address list panel
Make a UDF1 form, exit editor and show it.
Select other app to lose ce focus.
CTRL+` (backtick) to close the UDF1 form.
Code: |
<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
<CheatEntries>
<CheatEntry>
<ID>9</ID>
<Description>"xxxx close form"</Description>
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>{$lua}
if not syntaxcheck and UDF1 then pcall(UDF1.Close) end
[ENABLE]
[DISABLE]
</AssemblerScript>
<Hotkeys>
<Hotkey>
<Action>Toggle Activation</Action>
<Keys>
<Key>17</Key>
<Key>192</Key>
</Keys>
<ID>0</ID>
</Hotkey>
</Hotkeys>
</CheatEntry>
</CheatEntries>
</CheatTable>
|
_________________
- Retarded. |
|
Back to top |
|
 |
Game Hacking Dojo Master Cheater
Reputation: 1
Joined: 17 Sep 2023 Posts: 250
|
Posted: Sun Nov 24, 2024 7:54 am Post subject: |
|
|
Thank you everyone
This one works the best:
AylinCE wrote: | Code: | UDF1.Show()
if clTmr1 then clTmr1.Destroy() clTmr1=nil end
clTmr1 = createTimer()
clTmr1.Interval=100
clTmr1.OnTimer=function()
if isKeyPressed(VK_ESCAPE) then
clTmr1.Destroy()
UDF1.Close()
--closeCE()
--return cafree
end
collectgarbage("count")
end
clTmr1.Enabled=true |
|
|
|
Back to top |
|
 |
Game Hacking Dojo Master Cheater
Reputation: 1
Joined: 17 Sep 2023 Posts: 250
|
Posted: Tue Nov 26, 2024 7:26 am Post subject: |
|
|
I believe this code is causing access violation
Code: | if hotkeys_timer then hotkeys_timer.Destroy() hotkeys_timer = nil end
hotkeys_timer = createTimer()
hotkeys_timer.Interval = 100
hotkeys_timer.OnTimer = function()
if isKeyPressed(VK_RETURN) then go_button.DoClick() end
if isKeyPressed(VK_CONTROL) and isKeyPressed(VK_F) then
if offset_checkbox.state == cbChecked and offset == true then
offset_checkbox.state = cbUnchecked
offset = false
else
offset_checkbox.state = cbChecked
offset = true
end
end
if isKeyPressed(VK_ESCAPE) then
hotkeys_timer.Destroy()
form.Close()
end
collectgarbage("count")
end
hotkeys_timer.Enabled = true |
Is it so? Is there a workaround?
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25796 Location: The netherlands
|
Posted: Tue Nov 26, 2024 8:15 am Post subject: |
|
|
change
Code: |
if isKeyPressed(VK_ESCAPE) then
hotkeys_timer.Destroy()
form.Close()
end
|
to
Code: |
if isKeyPressed(VK_ESCAPE) then
hotkeys_timer.Destroy()
hotkeys_timer=nil
form.Close()
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 |
|
 |
|