Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog Edit
#1
Can you help me?

Code:
Copy      Help
str a=
Peter
John
Anne
Albert

str b=
101
220
335
465


ARRAY(str) aa bb
aa=a
bb=b

BEGIN DIALOG
0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
1 Button 0x54030001 0x4 120 116 48 14 "OK"
2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
3 ComboBox 0x54230343 0x4 12 48 96 213 ""
4 Edit 0x54030880 0x204 120 48 96 14 ""
END DIALOG
DIALOG EDITOR: "" 0x2010601 "" ""

str controls = "3 4"
str cb3 e4
cb3=a

if(!ShowDialog("telephones" 0 &controls)) ret

In Dialog:

Anne-------- 335
#2
You need a smart dialog, that is, with a dialog procedure.

Macro:
Code:
Copy      Help
str a=
;Peter
;John
;Anne
;Albert


str b=
;101
;220
;335
;465


ARRAY(str)- numbers
numbers=b

str controls = "3 4"
str cb3 e4
cb3=a

if(!ShowDialog("Dialog4545" &Dialog4545 &controls)) ret

Function Dialog4545:
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;This function allows to execute code whenever some event
;(dialog created, button clicked, etc) occurs in dialog.
;The code must follow appropriate case statements.
;To add case statements for various messages (events), you
;can use the Events button in the Dialog Editor. Read more in Help.


;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 ComboBox 0x54230343 0x4 12 48 96 213 ""
;4 Edit 0x54030880 0x204 120 48 96 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010601 "" ""


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
ARRAY(str)- numbers
sel wParam
,case CBN_SELENDOK<<16|3
,_i=CB_SelectedItem(lParam)
,numbers[_i].setwintext(id(4 hDlg))
,
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1

Note: when pasting, use Edit -> Other formats -> paste escaped, or this dialog will not work.
#3
Thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)