正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- prototype NUMBER CustomDialog(BYREF STRING, BYREF BOOL);//BYREF 才能传出值
- function NUMBER CustomDialog(strRc, bOkBtnIsPress)
- BOOL bQuit;
- NUMBER nRc;
- NUMBER nControl;
-
- NUMBER nComboBoxID;//自定义的下拉框ID
- STRING strDlgName;//自定义的对话框名称
-
- STRING strTmp;
- LIST listPara;
- begin
- //上次不知道怎么使用自定义对话框, 这次突然明白了
- //按钮的定义好象只能是500~900, 忘了在哪看到的了
- //而且这个按钮不能用添加对话框时给的,必须要是自己手工加上的
- #define nID_MYOK 500//自己定义的确定按钮的ID
- nComboBoxID = 1302;//我们自己定义的下拉列表框ID是1302
- strDlgName = "LsCustomDialog";//我们自定义的对话框名称
- nRc = EzDefineDialog(strDlgName, ISUSER, strDlgName, 0);
- bQuit = FALSE;
-
- //create our list containing the combo box items
- listPara = ListCreate(STRINGLIST);
- //填充下拉列表框
- ListAddString(listPara, "选项1", AFTER);
- ListAddString(listPara, "选项2", AFTER);
- ListAddString(listPara, "选项3", AFTER);
- ListAddString(listPara, "选项4", AFTER);
- ListAddString(listPara, "选项5", AFTER);
- ListAddString(listPara, "选项6", AFTER);
- ListAddString(listPara, "选项7", AFTER);
-
- while(!bQuit)
- nControl = WaitOnDialog(strDlgName);
- switch (nControl)
- case DLG_INIT:
- CtrlSetList(strDlgName, nComboBoxID, listPara);
-
- //设置'选项3'为当前选项
- //方法由2种
- //1. 验证ok, 这种方法不用硬编码, 好些
- ListSetIndex(listPara, LISTFIRST);
- ListSetIndex(listPara, LISTNEXT);
- ListSetIndex(listPara, LISTNEXT);
-
- ListCurrentString(listPara, strTmp);//由ListSetIndex设置
- CtrlSetCurSel(strDlgName, nComboBoxID, strTmp);//设置ComboBox当前显示
-
- //2. 验证ok
- //CtrlSetCurSel(strDlgName, nComboBoxID, "选项3");//设置ComboBox当前显示
-
- bOkBtnIsPress = FALSE;
-
- // ...cases for other controls...
- case nID_MYOK: //我们自己定义的按钮ID, 确定的那个按钮
- bQuit = TRUE;
- bOkBtnIsPress = TRUE;
- endswitch;
- endwhile;
- CtrlGetCurSel(strDlgName, nComboBoxID, strRc);//传出用户的选择
- EndDialog(strDlgName);
- ReleaseDialog(strDlgName);
-
- ListDestroy(listPara);
-
- return nRc;
- end;
- //---------------------------------------------------------------------------
- // OnBegin
- //
- // The OnBegin event is called directly by the framework after the setup
- // initializes. Note that this event will be called AFTER "Initialization"
- // events (i.e.) OnSetTARGETDIR, OnCheckMediaPassword.
- //
- // Note: This event will not be called automatically in a
- // program...endprogram style setup.
- //---------------------------------------------------------------------------
- function OnBegin()
- BOOL bOK;
- NUMBER nRc;
- STRING strSelect;
- begin
- nRc = CustomDialog(strSelect, bOK);
- if(0 != nRc) then
- MessageBox("自定义对话框执行错误", INFORMATION | MB_OK);
- abort;
- endif;
-
- if(bOK) then
- MessageBox("您的选择是:" + strSelect, INFORMATION | MB_OK);
- else
- MessageBox("您取消了选择", INFORMATION | MB_OK);//这个对话框是没有取消按钮的
- endif;
- end;
复制代码自定义对话框资源
运行效果
可以运行的工程的上传位置
|