home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
pc3270sa.zip
/
vbdde
/
fsetcpos.frm
< prev
next >
Wrap
Text File
|
2002-02-28
|
10KB
|
350 lines
VERSION 4.00
Begin VB.Form FormSetCursorPosition
Caption = "Set Cursor Position"
ClientHeight = 3732
ClientLeft = 4296
ClientTop = 3000
ClientWidth = 3624
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 4056
Left = 4248
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 3732
ScaleWidth = 3624
Top = 2724
Width = 3720
Begin VB.ComboBox SessionIdList
BackColor = &H00FFFFC0&
ForeColor = &H00000000&
Height = 288
ItemData = "FSETCPOS.frx":0000
Left = 1320
List = "FSETCPOS.frx":0052
Sorted = -1 'True
Style = 2 'Dropdown List
TabIndex = 0
Top = 360
Width = 492
End
Begin VB.CommandButton ExitDlg
Cancel = -1 'True
Caption = "E&xit"
Height = 372
Left = 2400
TabIndex = 12
Top = 3240
Width = 852
End
Begin VB.CommandButton Execute
Caption = "&Execute"
Default = -1 'True
Height = 372
Left = 360
TabIndex = 11
Top = 3240
Width = 852
End
Begin VB.TextBox SetCursorDataText
BackColor = &H00C0FFFF&
Height = 288
Left = 1680
TabIndex = 13
Top = 3360
Visible = 0 'False
Width = 300
End
Begin VB.Frame RowColFrame
Caption = "Row, Column"
Enabled = 0 'False
ForeColor = &H80000008&
Height = 1332
Left = 1752
TabIndex = 6
Top = 1680
Width = 1644
Begin VB.TextBox ColumnText
BackColor = &H00FFFFC0&
Enabled = 0 'False
Height = 288
Left = 960
TabIndex = 10
Text = "80"
Top = 840
Width = 468
End
Begin VB.TextBox RowText
BackColor = &H00FFFFC0&
Enabled = 0 'False
Height = 288
Left = 960
TabIndex = 9
Text = "24"
Top = 360
Width = 468
End
Begin VB.Label ColumnLabel
Caption = "&Column"
Enabled = 0 'False
ForeColor = &H80000008&
Height = 252
Left = 240
TabIndex = 8
Top = 840
Width = 684
End
Begin VB.Label RowLabel
Caption = "&Row"
Enabled = 0 'False
ForeColor = &H80000008&
Height = 252
Left = 240
TabIndex = 7
Top = 360
Width = 684
End
End
Begin VB.Frame PSOffsetFrame
Caption = "&PS Offset"
ForeColor = &H80000008&
Height = 852
Left = 216
TabIndex = 4
Top = 1680
Width = 1452
Begin VB.TextBox PSOffsetText
BackColor = &H00FFFFC0&
Height = 288
Left = 480
MaxLength = 4
TabIndex = 5
Text = "1919"
Top = 360
Width = 492
End
End
Begin VB.Frame Frame1
Caption = "Cursor Position&Type"
ForeColor = &H80000008&
Height = 735
Left = 216
TabIndex = 1
Top = 840
Width = 3180
Begin VB.OptionButton RowColOption
Caption = "Row, Column"
ForeColor = &H80000008&
Height = 375
Left = 1245
TabIndex = 3
Top = 240
Width = 1455
End
Begin VB.OptionButton PSOffsetOption
Caption = "PS Offset"
ForeColor = &H80000008&
Height = 375
Left = 90
TabIndex = 2
Top = 240
Value = -1 'True
Width = 1065
End
End
Begin VB.Frame Frame2
Caption = "Input Parameters"
Height = 3012
Left = 120
TabIndex = 14
Top = 120
Width = 3372
Begin VB.Label Label1
Caption = "Session &Id"
Height = 252
Left = 120
TabIndex = 15
Top = 240
Width = 1092
End
End
End
Attribute VB_Name = "FormSetCursorPosition"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private Sub ChangePSOffsetGroup(Status As Integer)
PSOffsetFrame.Enabled = Status
PSOffsetText.Enabled = Status
End Sub
Private Sub ChangeRowColGroup(Status As Integer)
RowColFrame.Enabled = Status
RowLabel.Enabled = Status
RowText.Enabled = Status
ColumnLabel.Enabled = Status
ColumnText.Enabled = Status
End Sub
Private Sub Execute_Click()
On Error GoTo ErrHandler
FunctionComp = True
OldMousePointer = MousePointer
MousePointer = 11 ' Hour Glass Mouse Pointer
DisplayType$ = GetDisplayType$(SessionIdList.Text)
If DisplayType$ = "NONE" Then
MousePointer = OldMousePointer
MsgBox MSG_INVALID_PSID + SessionIdList.Text, 48, MSG_SAMPLE_PROG
Exit Sub
End If
temp$ = LTrim$(RTrim$(SessionIdList.Text))
If Len(temp$) > 0 Then
Topic$ = "Session" + SessionIdList.Text
Else
MousePointer = OldMousePointer
MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
Exit Sub
End If
If GetCursorPosition() = True Then
Item$ = "SETCURSOR"
rc = DoEvents() 'If you use VisualBasic V2.0, call
'DoEvents function each time before
'starting DDE conversation.
SetCursorDataText.LinkTimeout = -1
SetCursorDataText.LinkTopic = APPLICATION_NAME + "|" + Topic$
SetCursorDataText.LinkMode = COLD
SetCursorDataText.LinkItem = Item$
SetCursorDataText.LinkPoke
SetCursorDataText.LinkMode = NONE
MousePointer = OldMousePointer
If FunctionComp = True Then
MsgBox MSG_FUNCTION_COMP, 64, MSG_SAMPLE_PROG
EndStatus$ = MSG_OK
Else
MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
EndStatus$ = MSG_NG
End If
TempLogData$ = Time$ + ":Set Cursor Position : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """" + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + MSG_TOPIC + """" + Topic$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + MSG_ITEM + """" + Item$ + """" + Chr$(13) + Chr$(10)
LogData$(LogEnd) = TempLogData$
UpdateLogPointer
Loged = True
End If
Exit Sub
ErrHandler:
FunctionComp = False
Resume Next
End Sub
Private Sub ExitDlg_Click()
Hide
End Sub
Private Function GetCursorPosition() As Integer
Dim Row As String
Dim Column As String
GetCursorPosition = True
If PSOffsetOption.Value = True Then
temp$ = RTrim$(LTrim$(PSOffsetText.Text))
If Len(temp$) > 0 Then
SetCursorDataText.Text = temp$
Else
MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
GetCursorPosition = False
End If
Else
Row = RTrim$(LTrim$(RowText.Text))
Column = RTrim$(LTrim$(ColumnText.Text))
If (Len(Row) > 0) And (Len(Column)) > 0 Then
SetCursorDataText.Text = "R" + Row + "C" + Column
Else
MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
GetCursorPosition = False
End If
End If
End Function
Private Sub Form_Load()
SessionIdList.ListIndex = 0
End Sub
Private Sub PSOffsetOption_Click()
ChangePSOffsetGroup (True)
ChangeRowColGroup (False)
End Sub
Private Sub PSOffsetText_Change()
Dim NumericalValue As Integer
' If PSOffsetText.Text = "" Then
' PSOffsetText.Text = "0000"
' Exit Sub
' End If
InsertionPoint = PSOffsetText.SelStart
temp$ = PSOffsetText.Text
For Counter = 1 To Len(PSOffsetText.Text)
If InStr("0123456789", Mid(temp$, Counter, 1)) = 0 Then
Mid(temp$, Counter, 1) = "0"
End If
Next Counter
PSOffsetText.Text = temp$
PSOffsetText.SelStart = InsertionPoint
End Sub
Private Sub PSOffsetText_LostFocus()
length = Len(PSOffsetText.Text)
If length < 4 Then
PSOffsetText.SelStart = 0
PSOffsetText.SelText = Mid("0000", 1, 4 - length)
End If
End Sub
Private Sub RowColOption_Click()
ChangePSOffsetGroup (False)
ChangeRowColGroup (True)
End Sub
Private Sub UpdateLogPointer()
LogEnd = LogEnd + 1
If LogEnd = MAXLOGNUM + 1 Then
LogEnd = 0
End If
If LogTop = LogEnd Then
LogTop = LogTop + 1
If LogTop = MAXLOGNUM + 1 Then
LogTop = 0
End If
End If
End Sub