创建用户界面 1.2工具条( Button pads) Pu PushButta Pad"Utils"As Create But to 特T特 HelpMsg "Choose this but ton to display query dialog Calling but ton sub proc Icon I ICON ZOOM QUESTION Tool But ton HelpMsg "Use this tool to draw a new route 钮即 按下 Calling tool sub proc Ic MI ICON CROSSHAIR DrawMode DM CUSTOM LINE ToggleBut ton HelpMsg "Turn proximity checking on/of f 特户新 Calling toggle prox check 直到 用 Icon MI ICON RULER Check Title "Utilities Width 3 Show ton
·PushButton——触发式按钮。如图层控制按钮. 特点:用户单击一个触发式按钮时,按钮仍会弹回来。 ·ToggleButton——开关式按钮。如图例窗口显示/隐藏按钮. 特点:用户单击按钮时,按钮变成两种状态中的一种,即 按下或弹起。 ·ToolButton——工具按钮,如选择按钮. 特点:用户单击按钮时,一个工具将处于激活状态,直到 用户选择了另一个按钮。 新建工具条: CreateButtonPad “名称” as PushButton/ToggleButton/ToolButton 一、创建用户界面 1.2 工具条(ButtonPads)
修改工具条的属性: Alter button pad“主/绘图”Add/ Remove 可以重定位、显示隐藏工具条或增加删除工具条中的工具 修改单个工具的状态: Alter button 查询用户使用按钮的信息: Commandino() 工具条信息: Button PadInfo0 恢复标准工具条: Create Button Pads As default Alter But tonPad Id 3 Add Separator ToolBut ton Icon MI ICON CROSSHAIR HelpMsg "Draw a distance scale on a map\sCale Bar Cursor MI CURSOR CROSSHAIR Drawlode DM CUSTOM PoINt Calling custom tool routine Include "mapbasic. def If But tonPadInfo( Main". BTNPAD INFO FLOATING)Then then the Main pad is floating: now let's dock it Alter But tonPad Main" ToolbarPosition(0,0) Fixed End工f
修改工具条的属性:AlterButtonPad “主/绘图” Add/Remove 可以重定位、显示/隐藏工具条或增加删除工具条中的工具。 修改单个工具的状态:AlterButton 查询用户使用按钮的信息:Commandinfo() 工具条信息:ButtonPadInfo() 恢复标准工具条:Create ButtonPads As Default
创建用户界面 1.3对话框( Dialog) 1、标准对话框 Do you want to continue? (1)询问对话框:Ask( prompt,ok Dim more As Logical Stop more= Ask("Do you want to continue?",OK,"Stop (2)显示信息对话框: Note message Mapin This is sub1! Note Total of records processed: Strs( (3)状态条: Progress Bar ProgressBar " Writing data."Calling (4)FileOpen DIg( path, filename Dim s filename As string filename=File Open DIg(", "" "TAE 5) File SaveAsDg( path, filename, 取消二
一、创建用户界面 1.3 对话框(Dialog) 1、标准对话框: (1)询问对话框:Ask ( prompt , ok_text , cancel_text ) Dim more As Logical more = Ask("Do you want to continue?", "OK", "Stop") (2)显示信息对话框:Note message Note "Total # of records processed: " + Str$( i_count ) (3)状态条:ProgressBar ProgressBar "Writing data..." Calling write_out Range 600000 (4)FileOpenDlg( path , filename , filetype , prompt ) Dim s_filename As String s_filename = FileOpenDlg("","","TAB","Open Table") (5)FileSaveAsDlg ( path , filename, filetype, prompt )
2、创建用户自定义对话框:面 Dialog 请输入: ITitle title [Width w[ Height 确定取消 y I Calling ha Dialog Control Title "Search Control staticText I Control Title "Enter string to find Button utton i cancelButton MapBasic对话相 CheckBox GroupBox RadioGroup If EditText StaticText PenPicker/BrushPicker/SymbolPicker/ FontPicker ListBox multilist Box 3、修改对话框: Enc PopupMenu Alter MapInfo Dialog dialog D Alter MapInfo Dialog dialog D Default
2、创建用户自定义对话框: Dialog [ Title title ] [ Width w ] [ Height h ] [ Position x , y ] [ Calling handler ] Control control_clause [ Control control_clause . . . ] MapBasic对话框控件类型:Control 子句控制 3、修改对话框: Alter MapInfoDialog dialog_ID Alter MapInfoDialog dialog_ID Default
创建用户界面 1.4窗口( Windows) Integer Map、 Bro ope2nTa6 world Icter 1、显示/隱 Map From world win id FrontWindow( Map Basic S Set Window win_id Width 5 Height 3 b Message 2、新建窗口: Map from 统计窗口 :Open Table"world tion Browse ht 4 country 创建重新分 population POP rea(ob],"sg km")Density Create re From world umn 创建图例窗口: Create Legend I From Window windOw ID I Show Hide
一、创建用户界面 1.4 窗口(Windows) Map、Browse、Graph、Layout;Create Redistricter 1、显示/隐藏窗口:Open/Close Window MapBasic、Statistics、Legend、Info、Ruler、Help、Message 2、新建窗口: Map From 统计窗口:Graph Country, Population From Selection Layout Position (0, 0) Width 2 Height 4 创建重新分区窗口: Create Redistricter source_table By district_column 创建图例窗口:Create Legend [ From Window window_ID ] [ { Show | Hide } ]