Code: Select all
#SingleInstance,Force
Gui,Add,Hotkey,
Gui,Show,w200 h100
return
GuiClose:
ExitApp
Code: Select all
#SingleInstance,Force
Gui,Add,Hotkey,
Gui,Show,w200 h100
return
GuiClose:
ExitApp
Code: Select all
Gui, Font, cWhite
Gui, Color, Black, Blue
Gui,Add,Hotkey, , ^c
Gui,Add,Edit, , hello world
Gui,Show,w200 h100
return
GuiClose:
ExitApp
I was thinking more along the lines of through the windows api using dllcalls but the feedback I get from "Just me" suggests that it's likely more trouble than it's worth.iPhilip wrote: ↑29 May 2019, 13:20It looks like the Hotkey control does not allow custom background or font colors:
Code: Select all
Gui, Font, cWhite Gui, Color, Black, Blue Gui,Add,Hotkey, , ^c Gui,Add,Edit, , hello world Gui,Show,w200 h100 return GuiClose: ExitApp
Thank you.rommmcek wrote: ↑30 May 2019, 20:15Hi Hellbend!
Your Gui designs are fantastic! iPhilip suggested using Edit Control. I found the script I believe has a potential to replace Hotkey Control with Edit. I don't have time (and knowledge) to finish it, but with help of other members might be doable.SpoilerBye!
Code: Select all
#NoEnv
#SingleInstance,Force
Gui, +hwndHw
Gui, Color, d0c060, 4444444
Gui, Font, s14 cffff00 TAhoma
Gui,Add,Hotkey, W280 x10 y6 vEdt1 gEdt1 hwndHedt1
Gui,Add,Edit, x10 y6 w280 vEdt2 hwndHedt2 Background00ffff, None
Gui,Show, x1300 y150
OnMessage(0x133, "Focus_Hk")
SetTimer, FcEdt, 250
return
Focus_Hk() {
GuiControl, Focus, Edt1
}
FcEdt:
if !WinActive("ahk_id " Hw)
GuiControl, Focus, Edt2
return
Edt1:
GuiControlGet, Ehk,, Edt1
StringUpper, Ehk, Ehk , T
Ehk:=StrReplace(Ehk, "`+", "Shift + "), Ehk:=StrReplace(Ehk, "`!", "Alt + "), Ehk:=StrReplace(Ehk, "`^", "Ctrl + ")
if Ehk
GuiControl,, Edt2, % Ehk
else GuiControl,, Edt2, None
Return
^Esc::
GuiClose:
ExitApp
lol I love the approach
Code: Select all
#NoEnv
Gui, Font, cWhite
Gui, Color, Red, Black
Gui, Add, Hotkey, vHotkeyCtrl gHotkeyCtrlEvent
Gui, Add, Edit, yp vEditCtrl
HotkeyCtrlEvent()
Gui, Show
OnMessage(0x06, "HotkeyCtrlEvent") ; WM_ACTIVATE = 0x06
Return
HotkeyCtrlEvent() {
GuiControlGet, HotkeyCtrl
HotkeyCtrl := Format("{:T}", HotkeyCtrl)
HotkeyCtrl := StrReplace(HotkeyCtrl, "+", "Shift + ")
HotkeyCtrl := StrReplace(HotkeyCtrl, "^", "Ctrl + ")
HotkeyCtrl := StrReplace(HotkeyCtrl, "!", "Alt + ")
GuiControl, , EditCtrl, % HotkeyCtrl ? HotkeyCtrl : "None"
}
GuiClose:
ExitApp
It works perfectly as far as I can tell.
Code: Select all
#SingleInstance,Force
#NoEnv
Hotkey,% MyHotkey:="Numpad1",HKPress
Gui, Font, cWhite
Gui, Color, Red, Black
Gui, Add, Hotkey, vHotkeyCtrl gHotkeyCtrlEvent,% MyHotkey
Gui, Add, Edit, yp vEditCtrl
HotkeyCtrlEvent()
Gui,Add,Button,gUpdateHK,Update
Gui, Show
OnMessage(0x06, "HotkeyCtrlEvent")
Return
GuiClose:
ExitApp
UpdateHK:
GuiControlGet,New_Hotkey,,HotkeyCtrl
if(New_Hotkey!=MyHotkey&&New_Hotkey){
Hotkey,% MyHotkey,HKPress,Off
Hotkey,% MyHotkey:=New_Hotkey,HKPress,On
}
return
HKPress:
loop 3
soundbeep,% (A_Index=1)?(Beep:="500"):(Beep+=200)
return
HotkeyCtrlEvent() {
GuiControlGet, HotkeyCtrl
HotkeyCtrl := Format("{:T}", HotkeyCtrl)
HotkeyCtrl := StrReplace(HotkeyCtrl, "+", "Shift + ")
HotkeyCtrl := StrReplace(HotkeyCtrl, "^", "Ctrl + ")
HotkeyCtrl := StrReplace(HotkeyCtrl, "!", "Alt + ")
GuiControl, , EditCtrl, % HotkeyCtrl ? HotkeyCtrl : "None"
}
@rommmcek Thank you for noticing that. The version below solves that problem:
Code: Select all
#NoEnv
Gui, Font, cWhite
Gui, Color, Red, Black
Gui, Add, Hotkey, vHotkeyCtrl gHotkeyCtrlEvent
Gui, Add, Edit, yp vEditCtrl
Gui, Add, Edit, , Text Field
HotkeyCtrlEvent()
Gui, Show
OnMessage(0x0F, "HotkeyCtrlEvent") ; WM_PAINT = 0x0F
Return
HotkeyCtrlEvent() {
GuiControlGet, HotkeyCtrl
HotkeyCtrl := Format("{:T}", HotkeyCtrl)
HotkeyCtrl := StrReplace(HotkeyCtrl, "+", "Shift + ")
HotkeyCtrl := StrReplace(HotkeyCtrl, "^", "Ctrl + ")
HotkeyCtrl := StrReplace(HotkeyCtrl, "!", "Alt + ")
GuiControl, , EditCtrl, % HotkeyCtrl ? HotkeyCtrl : "None"
}
GuiClose:
ExitApp
Code: Select all
#NoEnv
#SingleInstance,Force
global ShiftDown
; ...
OnMessage(0x0F, "HotkeyCtrlEvent") ; WM_PAINT = 0x0F
OnMessage(0x100, "Wm_KeyDown")
OnMessage(0x101, "Wm_KeyUp")
Return
Wm_KeyDown(wp) {
(wp=16)? ShiftDown:=1: ""
}
Wm_KeyUp(wp) {
if (wp=9) {
GuiControlGet, CFoc, Focus
if (CFoc = "Edit1")
if ShiftDown ;|| GetKeyState("Shift", "P")
GuiControl, Focus, HotkeyCtrl
else ;GuiControl, Focus, BtnCtrl ;-next (successive) Control
ControlSend, % CFoc, {Tab}, % "ahk_id " WinExist("A")
}
if (wp=16)
SetTimer, ClearShift, -50
}
ClearShift:
ShiftDown:=""
return
; ….
Users browsing this forum: rc76 and 222 guests