#tag Window Begin Window createProfile BackColor = &hFFFFFF Backdrop = "" CloseButton = True Composite = False Frame = 0 FullScreen = False HasBackColor = False Height = 120 ImplicitInstance= True LiveResize = True MacProcID = 0 MaxHeight = 32000 MaximizeButton = False MaxWidth = 32000 MenuBar = "" MenuBarVisible = True MinHeight = 64 MinimizeButton = True MinWidth = 64 Placement = 0 Resizeable = False Title = "Create Profile" Visible = True Width = 300 Begin EditField EditField_Name AcceptTabs = "" Alignment = 0 AutoDeactivate = True BackColor = &hFFFFFF Bold = "" Border = True DataField = "" DataSource = "" Enabled = True Format = "" Height = 22 HelpTag = "" Index = -2147483648 InitialParent = "" Italic = "" Left = 20 LimitText = 0 LockBottom = "" LockedInPosition= False LockLeft = "" LockRight = "" LockTop = "" Mask = "" Multiline = "" Password = "" ReadOnly = "" Scope = 0 ScrollbarHorizontal= "" ScrollbarVertical= True Styled = "" TabIndex = 0 TabPanelIndex = 0 TabStop = True Text = "" TextColor = &h000000 TextFont = "System" TextSize = 0 TextUnit = 0 Top = 46 Underline = "" UseFocusRing = True Visible = True Width = 260 End Begin PushButton PushButton_OK AutoDeactivate = True Bold = "" Cancel = "" Caption = "OK" Default = "" Enabled = True Height = 20 HelpTag = "" Index = -2147483648 InitialParent = "" Italic = "" Left = 20 LockBottom = "" LockedInPosition= False LockLeft = "" LockRight = "" LockTop = "" Scope = 0 TabIndex = 1 TabPanelIndex = 0 TabStop = True TextFont = "System" TextSize = 0 TextUnit = 0 Top = 80 Underline = "" Visible = True Width = 80 End Begin PushButton PushButton_Cancel AutoDeactivate = True Bold = "" Cancel = "" Caption = "Cancel" Default = "" Enabled = True Height = 20 HelpTag = "" Index = -2147483648 InitialParent = "" Italic = "" Left = 200 LockBottom = "" LockedInPosition= False LockLeft = "" LockRight = "" LockTop = "" Scope = 0 TabIndex = 2 TabPanelIndex = 0 TabStop = True TextFont = "System" TextSize = 0 TextUnit = 0 Top = 80 Underline = "" Visible = True Width = 80 End Begin StaticText StaticText_name AutoDeactivate = True Bold = "" DataField = "" DataSource = "" Enabled = True Height = 20 HelpTag = "" Index = -2147483648 InitialParent = "" Italic = "" Left = 20 LockBottom = "" LockedInPosition= False LockLeft = "" LockRight = "" LockTop = "" Multiline = "" Scope = 0 TabIndex = 3 TabPanelIndex = 0 Text = "Enter new profile name" TextAlign = 0 TextColor = &h000000 TextFont = "System" TextSize = 0 TextUnit = 0 Top = 14 Underline = "" Visible = True Width = 260 End End #tag EndWindow #tag WindowCode #tag Event Sub Open() allowedText = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -_."+chr(8)+chr(29)+chr(30)+chr(31)+chr(28)+chr(127) #if TargetLinux PushButton_Cancel.Height = 24 PushButton_OK.Height = 24 #endif End Sub #tag EndEvent #tag Property, Flags = &h0 allowedText As String #tag EndProperty #tag EndWindowCode #tag Events EditField_Name #tag Event Function KeyDown(Key As String) As Boolean Return InStr(allowedText,key)=0 End Function #tag EndEvent #tag EndEvents #tag Events PushButton_OK #tag Event Sub Action() dim success as Boolean if EditField_Name.Text <> "none" and EditField_Name.Text <> "None" and EditField_Name.Text <> "" then success = mainWindow.ICSSerialPort1.createProfile(EditField_Name.Text) if success = true then dim i as integer //cheesy way to update the popup menu mainWindow.PopupMenu_Profile.AddRow(EditField_Name.Text) for i = 0 to mainWindow.PopupMenu_Profile.ListCount - 1 if EditField_Name.Text = mainWindow.PopupMenu_Profile.List(i) then mainWindow.PopupMenu_Profile.ListIndex = i end if next self.Close else MsgBox "Error creating profile, please try a different name" end if end if End Sub #tag EndEvent #tag EndEvents #tag Events PushButton_Cancel #tag Event Sub Action() self.Close End Sub #tag EndEvent #tag EndEvents