source: trunk/desktop/createProfile.rbfrm @ 11

Revision 11, 6.0 KB checked in by pinwc4, 15 years ago (diff)

Added more database logic and a screen for creating a new profile

Line 
1#tag Window
2Begin Window createProfile
3   BackColor       =   &hFFFFFF
4   Backdrop        =   ""
5   CloseButton     =   True
6   Composite       =   False
7   Frame           =   0
8   FullScreen      =   False
9   HasBackColor    =   False
10   Height          =   120
11   ImplicitInstance=   True
12   LiveResize      =   True
13   MacProcID       =   0
14   MaxHeight       =   32000
15   MaximizeButton  =   False
16   MaxWidth        =   32000
17   MenuBar         =   ""
18   MenuBarVisible  =   True
19   MinHeight       =   64
20   MinimizeButton  =   True
21   MinWidth        =   64
22   Placement       =   0
23   Resizeable      =   False
24   Title           =   "Create Profile"
25   Visible         =   True
26   Width           =   300
27   Begin EditField EditField_Name
28      AcceptTabs      =   ""
29      Alignment       =   0
30      AutoDeactivate  =   True
31      BackColor       =   &hFFFFFF
32      Bold            =   ""
33      Border          =   True
34      DataField       =   ""
35      DataSource      =   ""
36      Enabled         =   True
37      Format          =   ""
38      Height          =   22
39      HelpTag         =   ""
40      Index           =   -2147483648
41      InitialParent   =   ""
42      Italic          =   ""
43      Left            =   20
44      LimitText       =   0
45      LockBottom      =   ""
46      LockedInPosition=   False
47      LockLeft        =   ""
48      LockRight       =   ""
49      LockTop         =   ""
50      Mask            =   ""
51      Multiline       =   ""
52      Password        =   ""
53      ReadOnly        =   ""
54      Scope           =   0
55      ScrollbarHorizontal=   ""
56      ScrollbarVertical=   True
57      Styled          =   ""
58      TabIndex        =   0
59      TabPanelIndex   =   0
60      TabStop         =   True
61      Text            =   ""
62      TextColor       =   &h000000
63      TextFont        =   "System"
64      TextSize        =   0
65      Top             =   46
66      Underline       =   ""
67      UseFocusRing    =   True
68      Visible         =   True
69      Width           =   260
70   End
71   Begin PushButton PushButton_OK
72      AutoDeactivate  =   True
73      Bold            =   ""
74      Cancel          =   ""
75      Caption         =   "OK"
76      Default         =   ""
77      Enabled         =   True
78      Height          =   20
79      HelpTag         =   ""
80      Index           =   -2147483648
81      InitialParent   =   ""
82      Italic          =   ""
83      Left            =   20
84      LockBottom      =   ""
85      LockedInPosition=   False
86      LockLeft        =   ""
87      LockRight       =   ""
88      LockTop         =   ""
89      Scope           =   0
90      TabIndex        =   1
91      TabPanelIndex   =   0
92      TabStop         =   True
93      TextFont        =   "System"
94      TextSize        =   0
95      Top             =   80
96      Underline       =   ""
97      Visible         =   True
98      Width           =   80
99   End
100   Begin PushButton PushButton_Cancel
101      AutoDeactivate  =   True
102      Bold            =   ""
103      Cancel          =   ""
104      Caption         =   "Cancel"
105      Default         =   ""
106      Enabled         =   True
107      Height          =   20
108      HelpTag         =   ""
109      Index           =   -2147483648
110      InitialParent   =   ""
111      Italic          =   ""
112      Left            =   200
113      LockBottom      =   ""
114      LockedInPosition=   False
115      LockLeft        =   ""
116      LockRight       =   ""
117      LockTop         =   ""
118      Scope           =   0
119      TabIndex        =   2
120      TabPanelIndex   =   0
121      TabStop         =   True
122      TextFont        =   "System"
123      TextSize        =   0
124      Top             =   80
125      Underline       =   ""
126      Visible         =   True
127      Width           =   80
128   End
129   Begin StaticText StaticText_name
130      AutoDeactivate  =   True
131      Bold            =   ""
132      DataField       =   ""
133      DataSource      =   ""
134      Enabled         =   True
135      Height          =   20
136      HelpTag         =   ""
137      Index           =   -2147483648
138      InitialParent   =   ""
139      Italic          =   ""
140      Left            =   20
141      LockBottom      =   ""
142      LockedInPosition=   False
143      LockLeft        =   ""
144      LockRight       =   ""
145      LockTop         =   ""
146      Multiline       =   ""
147      Scope           =   0
148      TabIndex        =   3
149      TabPanelIndex   =   0
150      Text            =   "Enter new profile name"
151      TextAlign       =   0
152      TextColor       =   &h000000
153      TextFont        =   "System"
154      TextSize        =   0
155      Top             =   14
156      Underline       =   ""
157      Visible         =   True
158      Width           =   260
159   End
160End
161#tag EndWindow
162
163#tag WindowCode
164        #tag Event
165                Sub Open()
166                  allowedText = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -_."+chr(8)+chr(29)+chr(30)+chr(31)+chr(28)+chr(127)
167                End Sub
168        #tag EndEvent
169
170
171        #tag Property, Flags = &h0
172                allowedText As String
173        #tag EndProperty
174
175
176#tag EndWindowCode
177
178#tag Events EditField_Name
179        #tag Event
180                Function KeyDown(Key As String) As Boolean
181                  Return InStr(allowedText,key)=0
182                End Function
183        #tag EndEvent
184#tag EndEvents
185#tag Events PushButton_OK
186        #tag Event
187                Sub Action()
188                  dim success as Boolean
189                 
190                 
191                  if EditField_Name.Text <> "none" and EditField_Name.Text <> "None" and EditField_Name.Text <> "" then
192                   
193                    success = mainWindow.ICSSerialPort1.createProfile(EditField_Name.Text)
194                   
195                    if success = true then
196                      dim i as integer
197                     
198                      //cheesy way to update the popup menu
199                      mainWindow.PopupMenu_Profile.AddRow(EditField_Name.Text)
200                     
201                      for i = 0 to mainWindow.PopupMenu_Profile.ListCount - 1
202                        if EditField_Name.Text = mainWindow.PopupMenu_Profile.List(i) then
203                          mainWindow.PopupMenu_Profile.ListIndex = i
204                        end if
205                      next
206                      self.Close
207                     
208                    else
209                     
210                      MsgBox "Error creating profile, please try a different name"
211                     
212                    end if
213                   
214                  end if
215                 
216                 
217                End Sub
218        #tag EndEvent
219#tag EndEvents
220#tag Events PushButton_Cancel
221        #tag Event
222                Sub Action()
223                  self.Close
224                End Sub
225        #tag EndEvent
226#tag EndEvents
Note: See TracBrowser for help on using the repository browser.