Description
Auxiliary script for key press scripts.
Syntax
KeyP(q, intkey) |
q
value of GetQualifier.
intkey
value of key pressed (0..9)
Example
Public Sub KeyPressX(ByVal strkey)
' replaces KeyPress0... KeyPress9
' to simulate KeyPress1, use KeyPressX("1")
Dim intkey = CInt(strkey)
Dim q = Fred.GetQualifier
If strkey = "0" Then
Select Case q
Case 0, 1 ' single or shift
KeyPress(0, 0)
Case Else
KeyP(q, intkey) ' call aux sub that handles apply of pref.values for stroke and fill
End Select
Else
KeyP(q, intkey) ' call aux sub that handles apply of pref.values for stroke and fill
End If
End Sub
Code
Public Sub KeyP(ByVal q, ByVal intkey)
Select Case q
Case 0, 1 : KeyPress(intkey, q)
Case 3 ' +Ctrl+Shift ' apply fill pref 0
SysApplyDefaults(2, intkey)
Case 4 ' +Alt
Page.ObjSetBorderWeight(Units.ToVal(intkey & cPt))
Case 5 ' +Alt+Shift
SysApplyDefaults(1, intkey) ' apply stroke pref 0
Case 6 ' ctrl+Alt
Dim strcolor As String = ""
Dim strTint As Short = 100
Dim aColorData = Split(Page.GetObjColor(1), ",")
If IsArray(aColorData) Then
If UBound(aColorData) >= 0 Then strcolor = aColorData(0)
If UBound(aColorData) = 1 Then strTint = aColorData(1)
End If
Page.ObjSetPaperColor(strcolor, IIf(intkey = 0, 100, intkey * 10))
Case 7 ' +Ctrl+Alt+Shift
If Page.GetSelectionCount > 1 Then
MsgBox("To store color/stroke preferences from selection, please have selected only one object (rule, frame or box)!", vbExclamation, m_Label) : Exit Sub
End If
Select Case Page.GetSelectedKind
Case POK.oRule : ObjSetAsStrokeDefaults(intkey)
Case POK.oBox, POK.oFrame, POK.oElli : ObjSetAsFillDefaults(intkey)
End Select
End Select
End Sub
See also