Last active
November 29, 2022 22:44
-
-
Save MarkGoldberg/4f4274a3a1fc6e7329c50240251304b5 to your computer and use it in GitHub Desktop.
ctSupressIME - clarion class suppress the right click IME menu appearing on Entry,Spin,Combo and Text controls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!FamilyClass(SuppressIME) | |
OMIT('**** Once ****',IFDEF_SuppressIME) | |
IFDEF_SuppressIME EQUATE(1) | |
ctSuppressIME CLASS,TYPE,MODULE('ctSuppressIME.clw'),LINK('ctSuppressIME.clw')!,_SuppressIMELinkMode_,DLL(_SuppressIMEDLLMode_) | |
AppsKeyDisabledFEQ SIGNED | |
NonIMEFEQ SIGNED | |
SaveFollowsFEQ SIGNED | |
SaveSelStart SIGNED | |
SaveSelEnd SIGNED | |
SaveSheetChoiceFEQ SIGNED | |
SaveTimerInterval LONG | |
TimerDelay LONG(42) | |
Construct PROCEDURE | |
DESTRUCT PROCEDURE | |
Init PROCEDURE() | |
OnPreAlertKey PROCEDURE(),LONG | |
OnAlertKey PROCEDURE(),LONG | |
!OnSelected PROCEDURE(),LONG | |
OnTimer PROCEDURE(),LONG | |
MakeNonIME PROCEDURE() | |
CleanUpNonIME PROCEDURE() | |
AlterControlsToSuppressNow PROCEDURE() | |
RestoreDesiredState PROCEDURE() | |
END | |
!END-OMIT('**** Once ****',IFDEF_SuppressIME) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!Region Modular | |
MEMBER | |
MAP | |
END | |
INCLUDE('ctSuppressIME.inc'),ONCE | |
_Register:Continue EQUATE(0) | |
_Register:Cycle EQUATE(5) | |
_Register:Break EQUATE(3) | |
AppsKey EQUATE(93) | |
eqDBG EQUATE('<4,2,7>') | |
!EndRegion Modular | |
!Region ctSuppressIME | |
!--------------------------------------------- | |
ctSuppressIME.Destruct PROCEDURE | |
CODE | |
!Assert(0,eqDBG&'ctSuppressIME.Destruct') | |
!------------------------------------------------- | |
ctSuppressIME.Construct PROCEDURE | |
CODE | |
SELF.SaveTimerInterval = 0 | |
SELF.AppsKeyDisabledFEQ = 0 | |
SELF.NonIMEFEQ = 0 | |
SELF.SaveFollowsFEQ = 0 | |
SELF.SaveTimerInterval = 0 | |
SELF.TimerDelay = 20 | |
SELF.SaveSelStart = 0 | |
SELF.SaveSelEnd = 0 | |
!------------------------------------------------- | |
ctSuppressIME.Init PROCEDURE() | |
CODE | |
REGISTER(EVENT:PreAlertKey , ADDRESS(SELF.OnPreAlertKey), ADDRESS(SELF)) | |
REGISTER(EVENT:AlertKey , ADDRESS(SELF.OnAlertKey ), ADDRESS(SELF)) | |
! REGISTER(EVENT:Selected , ADDRESS(SELF.OnSelected ), ADDRESS(SELF)) | |
REGISTER(EVENT:Timer , ADDRESS(SELF.OnTimer ), ADDRESS(SELF)) | |
!------------------------------------------------- | |
ctSuppressIME.OnPreAlertKey PROCEDURE()!,LONG | |
CODE | |
IF KEYCODE()=AppsKey | |
Assert(0,eqDBG&'ctSuppressIME.OnPreAlertKey On AppsKey = KeyCode()['& KeyCode() &']') | |
CASE FOCUS(){PROP:Type} | |
OF CREATE:entry | |
OROF CREATE:Spin | |
OROF CREATE:combo | |
OROF CREATE:text | |
SELF.AlterControlsToSuppressNow() | |
END | |
END | |
RETURN _Register:Continue | |
!------------------------------------------------- | |
ctSuppressIME.AlterControlsToSuppressNow PROCEDURE() | |
ParentFEQ SIGNED,AUTO | |
CODE | |
!DBG.Message('AlterControlsToSuppressNow') | |
SELF.AppsKeyDisabledFEQ = FOCUS() | |
SELF.SaveFollowsFEQ = SELF.AppsKeyDisabledFEQ{PROP:Follows} | |
SELF.SaveSelStart = SELF.AppsKeyDisabledFEQ{PROP:SelStart} | |
SELF.SaveSelEnd = SELF.AppsKeyDisabledFEQ{PROP:SelEnd} | |
ParentFEQ = FOCUS(){PROP:Parent} | |
IF ParentFEQ{PROP:Type} = Create:Tab | |
SELF.SaveSheetChoiceFEQ = (ParentFEQ{PROP:Parent}){PROP:ChoiceFEQ} | |
END | |
SELF.MakeNonIME() | |
0{PROP:Selected} = SELF.NonIMEFEQ | |
!Assert(0,eqDBG&'SELF.NonIMEFEQ['& SELF.NonIMEFEQ &'] SELF.AppsKeyDisabledFEQ{{PROP:Parent}['& SELF.AppsKeyDisabledFEQ{PROP:Parent} &'] SELF.AppsKeyDisabledFEQ['& SELF.AppsKeyDisabledFEQ &']') | |
SELF.AppsKeyDisabledFEQ{PROP:Follows} = SELF.NonIMEFEQ | |
DISABLE(SELF.AppsKeyDisabledFEQ) | |
0{PROP:Selected} = SELF.NonIMEFEQ | |
!SELECT(SELF.NonIMEFEQ) | |
!------------------------------------------------- | |
ctSuppressIME.MakeNonIME PROCEDURE() | |
CODE | |
! SELF.NonIMEFEQ = ?CHECK1 | |
! RETURN | |
SELF.NonIMEFEQ = CREATE(0, CREATE:check, SELF.AppsKeyDisabledFEQ{PROP:Parent}) | |
SELF.NonIMEFEQ{PROP:Follows} = SELF.AppsKeyDisabledFEQ | |
SELF.NonIMEFEQ{PROP:Enabled} = TRUE !still hidden however | |
SELF.NonIMEFEQ{PROP:Text} = 'Avoid IME' | |
!SELF.NonIMEFEQ{PROP:Hide} = FALSE !<-- temp debugging | |
!!! | |
!!! DBG.Message('Created.. SELF.NonIMEFEQ['& SELF.NonIMEFEQ &']') | |
!!! DBG.DumpControls() | |
!------------------------------------------------- | |
ctSuppressIME.CleanUpNonIME PROCEDURE() | |
CODE | |
DESTROY(SELF.NonIMEFEQ) | |
SELF.NonIMEFEQ = 0 | |
!------------------------------------------------- | |
ctSuppressIME.OnAlertKey PROCEDURE()!,LONG | |
CODE | |
! Assert(0,eqDBG&'ctSuppressIME.OnAlertKey KeyCode()['& KeyCode() &']') | |
IF KEYCODE()=AppsKey AND SELF.AppsKeyDisabledFEQ | |
SELF.SaveTimerInterval = 0{PROP:Timer} + 0 | |
IF ~SELF.SaveTimerInterval THEN SELF.SaveTimerInterval = -1 END | |
0{PROP:Timer} = SELF.TimerDelay !<-- too small and this won't work, which means this is susceptible to race conditions (not good) (VMDEV 9 works, 8 doesn't) | |
!DBG.Message('Alert-AppsKey, enabling Timer SELF.SaveTimerInterval['& SELF.SaveTimerInterval &']') | |
END | |
RETURN _Register:Continue | |
!------------------------------------------------- | |
ctSuppressIME.OnTimer PROCEDURE()!,LONG | |
CODE | |
!DBG.Message('.OnTimer SELF.SaveTimerInterval['& SELF.SaveTimerInterval &']') | |
IF SELF.SaveTimerInterval | |
0{PROP:Timer}= CHOOSE( SELF.SaveTimerInterval=-1, 0, SELF.SaveTimerInterval) | |
SELF.SaveTimerInterval = 0 | |
SELF.RestoreDesiredState() | |
RETURN _Register:Cycle !<------------------ | |
END | |
RETURN _Register:Continue | |
!------------------------------------------------- | |
ctSuppressIME.RestoreDesiredState PROCEDURE | |
CODE | |
SELF.AppsKeyDisabledFEQ{PROP:Follows} = SELF.SaveFollowsFEQ | |
ENABLE(SELF.AppsKeyDisabledFEQ) | |
SELECT(SELF.AppsKeyDisabledFEQ, SELF.SaveSelStart, SELF.SaveSelEnd ) | |
IF SELF.SaveSheetChoiceFEQ | |
! focus was on a TAB on a SHEET | |
( (SELF.AppsKeyDisabledFEQ{PROP:Parent}) {PROP:Parent}){PROP:ChoiceFEQ} = SELF.SaveSheetChoiceFEQ | |
SELF.SaveSheetChoiceFEQ = 0 | |
END | |
SELF.CleanUpNonIME() | |
!ctSuppressIME.OnSelected PROCEDURE()!,LONG | |
! CODE | |
! IF SELECTED() = SELF.NonIMEFEQ | |
! 0{PROP:Timer} = 42 | |
!!!! POST(EVENT:User) | |
! !SELECT(SELF.AppsKeyDisabledFEQ) | |
!!!! DESTROY(SELF.NonIMEFEQ) | |
! SELF.NonIMEFEQ = 0 | |
! END | |
! RETURN _Register:Continue | |
!EndRegion ctSuppressIME | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INCLUDE('ctSuppressIME.inc'),ONCE | |
SuppressIME ctSuppressIME | |
CODE | |
! after OpenWindow | |
SupressIME.INIT() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment