Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Restores the CapasLock key state
#1
Hi,

I defined a hotkey(CapsLock) in the dialog, and when pressed, it selects the text of the current line

But it still works, The case status is set.
how to restore the Caps original state after executing the command?

Thanks in advance for any advice and help
david



Macro Macro2
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54020080 0x200 8 24 208 12 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

str controls = "3"
str e3
e3="hello world!"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAccelerators(hDlg "401 K")
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 401 ;;CapasLock
,CapsLock(0) ;;No effect
,key ESH
ret 1
#2
Below case 401 insert out "CL" and you'll see why. Need to temporarily disable CapsLock hotkey processing in the dialog. But better don't use CapsLock as a hotkey.
#3
Thanks for the reminder
How temporarily disable CapsLock? 

I use alt+s  No effect
DT_SetAccelerators(hDlg "401 As")
#4
Probably Alt interferes with ESH. Use a single key, such as F5.
#5
F5 is less convenient
CapsLock key operation up, convenient, effective, in addition to the above disadvantages  Smile
#6
If CapsLock never used, remap it to another key, for example F13. And use F13 as hotkey in any dialog.

To remap, can be used: toolbar -> More tools -> Customize keyboard -> Remap keys. Then restart Windows. It disables CapsLock completely.

Or use this function. It disables CapsLock but not Shift+CapsLock etc.

Function RemapKey_CapsLock_F13
Trigger K     Help - how to add the trigger to the macro
Code:
Copy      Help
opt keysync 1
key F13
#7
a bit complicated, I use CapsLock trigger in many other programs
no other way to check if the capsLock light is on? I just want the caps light to go out
Using the method below, it also no effect
ifk(K 1) key K
ifk(K) key- K

I use the following code to quickly add single or double quotes to the text inside the edit box
only one small problem, Unable to turn off CapsLock Undecided

    case 401 ;;CapsLock
    key ESH
    _s.getsel
    _s.trim
    if !_s.beg("'") and !_s.beg("''")
        _s=F"'{_s}'"
        _s.setsel
    else if _s.beg("'")
        _s.findreplace("'" "''")
        _s.setsel
    else if _s.beg("''")
        _s.findreplace("''" "")
        _s.setsel
    key K ;;CapsLock turn off
#8
The problem was solved  Smile
Release the S key
Add a delay

    key ESH
    _s.getsel
    _s.trim
    if !_s.beg("'") and !_s.beg("''")
        _s=F"'{_s}'"
        _s.setsel
        key- S
    else if _s.beg("'")
        _s.findreplace("'" "''")
        _s.setsel
        key- S
    else if _s.beg("''")
        _s.findreplace("''" "")
        _s.setsel
    0.2
    key S ;;CapsLock turn off


But the order of logical execution is reversed, Why?


Forum Jump:


Users browsing this thread: 1 Guest(s)