home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pc3270sa.zip / vbdde / fsetcpos.frm < prev    next >
Text File  |  2002-02-28  |  10KB  |  350 lines

  1. VERSION 4.00
  2. Begin VB.Form FormSetCursorPosition 
  3.    Caption         =   "Set Cursor Position"
  4.    ClientHeight    =   3732
  5.    ClientLeft      =   4296
  6.    ClientTop       =   3000
  7.    ClientWidth     =   3624
  8.    BeginProperty Font 
  9.       name            =   "MS Sans Serif"
  10.       charset         =   0
  11.       weight          =   700
  12.       size            =   7.8
  13.       underline       =   0   'False
  14.       italic          =   0   'False
  15.       strikethrough   =   0   'False
  16.    EndProperty
  17.    ForeColor       =   &H80000008&
  18.    Height          =   4056
  19.    Left            =   4248
  20.    LinkMode        =   1  'Source
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   3732
  23.    ScaleWidth      =   3624
  24.    Top             =   2724
  25.    Width           =   3720
  26.    Begin VB.ComboBox SessionIdList 
  27.       BackColor       =   &H00FFFFC0&
  28.       ForeColor       =   &H00000000&
  29.       Height          =   288
  30.       ItemData        =   "FSETCPOS.frx":0000
  31.       Left            =   1320
  32.       List            =   "FSETCPOS.frx":0052
  33.       Sorted          =   -1  'True
  34.       Style           =   2  'Dropdown List
  35.       TabIndex        =   0
  36.       Top             =   360
  37.       Width           =   492
  38.    End
  39.    Begin VB.CommandButton ExitDlg 
  40.       Cancel          =   -1  'True
  41.       Caption         =   "E&xit"
  42.       Height          =   372
  43.       Left            =   2400
  44.       TabIndex        =   12
  45.       Top             =   3240
  46.       Width           =   852
  47.    End
  48.    Begin VB.CommandButton Execute 
  49.       Caption         =   "&Execute"
  50.       Default         =   -1  'True
  51.       Height          =   372
  52.       Left            =   360
  53.       TabIndex        =   11
  54.       Top             =   3240
  55.       Width           =   852
  56.    End
  57.    Begin VB.TextBox SetCursorDataText 
  58.       BackColor       =   &H00C0FFFF&
  59.       Height          =   288
  60.       Left            =   1680
  61.       TabIndex        =   13
  62.       Top             =   3360
  63.       Visible         =   0   'False
  64.       Width           =   300
  65.    End
  66.    Begin VB.Frame RowColFrame 
  67.       Caption         =   "Row, Column"
  68.       Enabled         =   0   'False
  69.       ForeColor       =   &H80000008&
  70.       Height          =   1332
  71.       Left            =   1752
  72.       TabIndex        =   6
  73.       Top             =   1680
  74.       Width           =   1644
  75.       Begin VB.TextBox ColumnText 
  76.          BackColor       =   &H00FFFFC0&
  77.          Enabled         =   0   'False
  78.          Height          =   288
  79.          Left            =   960
  80.          TabIndex        =   10
  81.          Text            =   "80"
  82.          Top             =   840
  83.          Width           =   468
  84.       End
  85.       Begin VB.TextBox RowText 
  86.          BackColor       =   &H00FFFFC0&
  87.          Enabled         =   0   'False
  88.          Height          =   288
  89.          Left            =   960
  90.          TabIndex        =   9
  91.          Text            =   "24"
  92.          Top             =   360
  93.          Width           =   468
  94.       End
  95.       Begin VB.Label ColumnLabel 
  96.          Caption         =   "&Column"
  97.          Enabled         =   0   'False
  98.          ForeColor       =   &H80000008&
  99.          Height          =   252
  100.          Left            =   240
  101.          TabIndex        =   8
  102.          Top             =   840
  103.          Width           =   684
  104.       End
  105.       Begin VB.Label RowLabel 
  106.          Caption         =   "&Row"
  107.          Enabled         =   0   'False
  108.          ForeColor       =   &H80000008&
  109.          Height          =   252
  110.          Left            =   240
  111.          TabIndex        =   7
  112.          Top             =   360
  113.          Width           =   684
  114.       End
  115.    End
  116.    Begin VB.Frame PSOffsetFrame 
  117.       Caption         =   "&PS Offset"
  118.       ForeColor       =   &H80000008&
  119.       Height          =   852
  120.       Left            =   216
  121.       TabIndex        =   4
  122.       Top             =   1680
  123.       Width           =   1452
  124.       Begin VB.TextBox PSOffsetText 
  125.          BackColor       =   &H00FFFFC0&
  126.          Height          =   288
  127.          Left            =   480
  128.          MaxLength       =   4
  129.          TabIndex        =   5
  130.          Text            =   "1919"
  131.          Top             =   360
  132.          Width           =   492
  133.       End
  134.    End
  135.    Begin VB.Frame Frame1 
  136.       Caption         =   "Cursor Position&Type"
  137.       ForeColor       =   &H80000008&
  138.       Height          =   735
  139.       Left            =   216
  140.       TabIndex        =   1
  141.       Top             =   840
  142.       Width           =   3180
  143.       Begin VB.OptionButton RowColOption 
  144.          Caption         =   "Row, Column"
  145.          ForeColor       =   &H80000008&
  146.          Height          =   375
  147.          Left            =   1245
  148.          TabIndex        =   3
  149.          Top             =   240
  150.          Width           =   1455
  151.       End
  152.       Begin VB.OptionButton PSOffsetOption 
  153.          Caption         =   "PS Offset"
  154.          ForeColor       =   &H80000008&
  155.          Height          =   375
  156.          Left            =   90
  157.          TabIndex        =   2
  158.          Top             =   240
  159.          Value           =   -1  'True
  160.          Width           =   1065
  161.       End
  162.    End
  163.    Begin VB.Frame Frame2 
  164.       Caption         =   "Input Parameters"
  165.       Height          =   3012
  166.       Left            =   120
  167.       TabIndex        =   14
  168.       Top             =   120
  169.       Width           =   3372
  170.       Begin VB.Label Label1 
  171.          Caption         =   "Session &Id"
  172.          Height          =   252
  173.          Left            =   120
  174.          TabIndex        =   15
  175.          Top             =   240
  176.          Width           =   1092
  177.       End
  178.    End
  179. End
  180. Attribute VB_Name = "FormSetCursorPosition"
  181. Attribute VB_Creatable = False
  182. Attribute VB_Exposed = False
  183.  
  184.  
  185.  
  186. Private Sub ChangePSOffsetGroup(Status As Integer)
  187.     PSOffsetFrame.Enabled = Status
  188.     PSOffsetText.Enabled = Status
  189. End Sub
  190.  
  191. Private Sub ChangeRowColGroup(Status As Integer)
  192.  
  193.     RowColFrame.Enabled = Status
  194.     RowLabel.Enabled = Status
  195.     RowText.Enabled = Status
  196.     ColumnLabel.Enabled = Status
  197.     ColumnText.Enabled = Status
  198.  
  199. End Sub
  200.  
  201. Private Sub Execute_Click()
  202. On Error GoTo ErrHandler
  203.    FunctionComp = True
  204.    
  205.    OldMousePointer = MousePointer
  206.    MousePointer = 11 ' Hour Glass Mouse Pointer
  207.    
  208.    DisplayType$ = GetDisplayType$(SessionIdList.Text)
  209.    
  210.    If DisplayType$ = "NONE" Then
  211.       MousePointer = OldMousePointer
  212.       MsgBox MSG_INVALID_PSID + SessionIdList.Text, 48, MSG_SAMPLE_PROG
  213.       Exit Sub
  214.    End If
  215.    
  216.    temp$ = LTrim$(RTrim$(SessionIdList.Text))
  217.    If Len(temp$) > 0 Then
  218.       Topic$ = "Session" + SessionIdList.Text
  219.    Else
  220.       MousePointer = OldMousePointer
  221.       MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  222.       Exit Sub
  223.    End If
  224.  
  225.    If GetCursorPosition() = True Then
  226.       Item$ = "SETCURSOR"
  227.       rc = DoEvents()           'If you use VisualBasic V2.0, call
  228.                                 'DoEvents function each time before
  229.                                 'starting DDE conversation.
  230.       SetCursorDataText.LinkTimeout = -1
  231.       SetCursorDataText.LinkTopic = APPLICATION_NAME + "|" + Topic$
  232.       SetCursorDataText.LinkMode = COLD
  233.       SetCursorDataText.LinkItem = Item$
  234.       SetCursorDataText.LinkPoke
  235.       SetCursorDataText.LinkMode = NONE
  236.       
  237.       MousePointer = OldMousePointer
  238.       If FunctionComp = True Then
  239.          MsgBox MSG_FUNCTION_COMP, 64, MSG_SAMPLE_PROG
  240.          EndStatus$ = MSG_OK
  241.       Else
  242.          MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
  243.          EndStatus$ = MSG_NG
  244.       End If
  245.       TempLogData$ = Time$ + ":Set Cursor Position : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
  246.       TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """" + Chr$(13) + Chr$(10) + Chr$(9)
  247.       TempLogData$ = TempLogData$ + MSG_TOPIC + """" + Topic$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
  248.       TempLogData$ = TempLogData$ + MSG_ITEM + """" + Item$ + """" + Chr$(13) + Chr$(10)
  249.       LogData$(LogEnd) = TempLogData$
  250.       UpdateLogPointer
  251.       Loged = True
  252.    End If
  253.    Exit Sub
  254.  
  255. ErrHandler:
  256.    FunctionComp = False
  257.    Resume Next
  258. End Sub
  259.  
  260. Private Sub ExitDlg_Click()
  261.     Hide
  262. End Sub
  263.  
  264. Private Function GetCursorPosition() As Integer
  265.    Dim Row As String
  266.    Dim Column As String
  267.  
  268.    GetCursorPosition = True
  269.    If PSOffsetOption.Value = True Then
  270.       temp$ = RTrim$(LTrim$(PSOffsetText.Text))
  271.       If Len(temp$) > 0 Then
  272.          SetCursorDataText.Text = temp$
  273.       Else
  274.          MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  275.          GetCursorPosition = False
  276.       End If
  277.    Else
  278.       Row = RTrim$(LTrim$(RowText.Text))
  279.       Column = RTrim$(LTrim$(ColumnText.Text))
  280.       If (Len(Row) > 0) And (Len(Column)) > 0 Then
  281.          SetCursorDataText.Text = "R" + Row + "C" + Column
  282.       Else
  283.          MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  284.          GetCursorPosition = False
  285.       End If
  286.    End If
  287. End Function
  288.  
  289. Private Sub Form_Load()
  290.   SessionIdList.ListIndex = 0
  291. End Sub
  292.  
  293. Private Sub PSOffsetOption_Click()
  294.     
  295.     ChangePSOffsetGroup (True)
  296.     ChangeRowColGroup (False)
  297.  
  298. End Sub
  299.  
  300. Private Sub PSOffsetText_Change()
  301. Dim NumericalValue As Integer
  302.  
  303. '  If PSOffsetText.Text = "" Then
  304. '    PSOffsetText.Text = "0000"
  305. '    Exit Sub
  306. '  End If
  307.   
  308.   InsertionPoint = PSOffsetText.SelStart
  309.   temp$ = PSOffsetText.Text
  310.   For Counter = 1 To Len(PSOffsetText.Text)
  311.     If InStr("0123456789", Mid(temp$, Counter, 1)) = 0 Then
  312.       Mid(temp$, Counter, 1) = "0"
  313.     End If
  314.   Next Counter
  315.   PSOffsetText.Text = temp$
  316.   PSOffsetText.SelStart = InsertionPoint
  317.  
  318. End Sub
  319.  
  320. Private Sub PSOffsetText_LostFocus()
  321.   length = Len(PSOffsetText.Text)
  322.   If length < 4 Then
  323.     PSOffsetText.SelStart = 0
  324.     PSOffsetText.SelText = Mid("0000", 1, 4 - length)
  325.   End If
  326. End Sub
  327.  
  328.  
  329. Private Sub RowColOption_Click()
  330.     
  331.     ChangePSOffsetGroup (False)
  332.     ChangeRowColGroup (True)
  333.     
  334. End Sub
  335.  
  336. Private Sub UpdateLogPointer()
  337.     LogEnd = LogEnd + 1
  338.     If LogEnd = MAXLOGNUM + 1 Then
  339.        LogEnd = 0
  340.     End If
  341.  
  342.     If LogTop = LogEnd Then
  343.        LogTop = LogTop + 1
  344.        If LogTop = MAXLOGNUM + 1 Then
  345.           LogTop = 0
  346.        End If
  347.     End If
  348. End Sub
  349.  
  350.