09-09-2005, 07:11 PM
Sorry Ken, I accidentally deleted your message. You wrote:
______________________________________________
Method 1
In the dialog procedure, use str.getwintext or other functions to get data from the edit control, as well as from other controls you need.
Function ken_gray_dialog:
Method 2
Use an user-defined type for dialog controls. Set its name in Dialog Editor Options. In the dialog procedure, call DT_GetControls(hDlg). This function retrieves data from dialog controls in the same way and format as when you click OK. It returns pointer to the variable that was passed to ShowDialog, so you can assign it to a reference variable of that type. This method is is better if you have many controls to get data from, or if you don't know how to explicitly get data from particular controls.
Function ken_gray_dialog2:
Whenever you add or remove controls, QM shows a warning message box, because the type definition is changed. In most cases you can safely click OK.
Quote:im trying to get a little list of things into a dialoge box that reads from a text file. i want to add items to that list within the dialoge form and save it with a button click but i cant seem to send the form contents back to the macro with out causing the dialoge to close (sending the string back to the macro, doing a setfile command, and then restarting just before the dialoge initialization line). heres my dialoge code; how do i change it just to do a save?
;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 92 118 "Form"
;3 Edit 0x54231044 0x204 0 0 88 98 ""
;1 Button 0x54030001 0x4 6 102 40 14 "Save"
;2 Button 0x54030000 0x4 52 102 34 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2010703 "" ""
ret
;messages
sel message
,case WM_INITDIALOG DT_Init(hDlg lParam); ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 1 e3.setfile("C:\qm\projects.txt")
,case IDCANCEL DT_Cancel hDlg
ret 1
thanks
______________________________________________
Method 1
In the dialog procedure, use str.getwintext or other functions to get data from the edit control, as well as from other controls you need.
Function ken_gray_dialog:
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str e3
if(!ShowDialog("ken_gray_dialog" &ken_gray_dialog &controls)) ret
;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x200 4 4 96 14 ""
;4 Button 0x54032000 0x0 118 116 48 14 "Save"
;END DIALOG
;DIALOG EDITOR: "" 0x2010703 "*" ""
ret
;messages
sel message
,case WM_INITDIALOG DT_Init(hDlg lParam); ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4 ;;Save
,str s.getwintext(id(3 hDlg))
,s.setfile("C:\qm\projects.txt")
,
,case IDCANCEL DT_Cancel hDlg
ret 1
Method 2
Use an user-defined type for dialog controls. Set its name in Dialog Editor Options. In the dialog procedure, call DT_GetControls(hDlg). This function retrieves data from dialog controls in the same way and format as when you click OK. It returns pointer to the variable that was passed to ShowDialog, so you can assign it to a reference variable of that type. This method is is better if you have many controls to get data from, or if you don't know how to explicitly get data from particular controls.
Function ken_gray_dialog2:
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
type KEN_GRAY_DIALOG2 ~controls ~e3 ~c5Che
KEN_GRAY_DIALOG2 d.controls="3 5"
if(!ShowDialog("ken_gray_dialog2" &ken_gray_dialog2 +&d)) ret
;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
;2 Button 0x54030001 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x204 4 4 96 14 ""
;4 Button 0x54032000 0x4 118 116 48 14 "Save"
;5 Button 0x54012003 0x4 6 32 48 13 "Check"
;END DIALOG
;DIALOG EDITOR: "KEN_GRAY_DIALOG2" 0x2010703 "*" ""
ret
;messages
sel message
,case WM_INITDIALOG DT_Init(hDlg lParam); ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4 ;;Save
,KEN_GRAY_DIALOG2& dd=DT_GetControls(hDlg)
,out dd.e3
,out dd.c5Che
,;dd.e3.setfile("C:\qm\projects.txt")
,
,case IDCANCEL DT_Cancel hDlg
ret 1
Whenever you add or remove controls, QM shows a warning message box, because the type definition is changed. In most cases you can safely click OK.