Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding Dialog to Keep employee names
#1
High i have a simple smart dialog.

Employee_List (Function)/Dialog

;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Name List"
;1 Button 0x54030001 0x4 2 110 48 14 "OK"
;2 Button 0x54030000 0x4 60 110 48 14 "Cancel"
;3 ComboBox 0x54230641 0x0 6 16 96 48 ""
;4 Button 0x54020007 0x0 2 2 108 100 "Employee Names "
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

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 IDOK
,DT_Ok hDlg ;;*
,case IDCANCEL DT_Cancel hDlg ;;*
ret 1

;* - not necessary in QM >= 2.1.9

Is there a way that when i type the name into the box and hit enter that it will save the Employees First name?
If you could help me with this code that would be greatly appreciated. Thanks a ton!
#2
Where do you want the information stored at? In the white space below? In a dropdown list?
Taking on Quick Macros one day at a time
#3
QM Assistant Wrote:Where do you want the information stored at? In the white space below? In a dropdown list?
Yes i want to make it so that when i type my text into the id box 1000 and hit enter it will store the Name into the id 1001. Is there a way to do that?
#4
Yes the dropdown list*
#5
This uses button + instead of Enter.
Function Function76
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str cb3
if(!ShowDialog("Function76" &Function76 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Name List"
;1 Button 0x54030001 0x4 2 110 48 14 "OK"
;2 Button 0x54030000 0x4 60 110 48 14 "Cancel"
;3 ComboBox 0x54230641 0x0 6 16 96 56 ""
;5 Button 0x54032000 0x0 104 16 18 14 "+"
;6 Button 0x54032000 0x0 104 32 18 14 "-"
;4 Button 0x54020007 0x0 2 2 126 96 "Employee Names "
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

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 5 ;;+
,str s.getwintext(id(3 hDlg))
,s.trim; if(!s.len) ret
,CB_Add id(3 hDlg) s
,;SendMessage id(3 hDlg) CB_ADDSTRING 0 s ;;use this instead of the above line if CB_Add is unavailable
,
,case 6 ;;-
,int i=CB_SelectedItem(id(3 hDlg))
,if(i<0) ret
,SendMessage id(3 hDlg) CB_DELETESTRING i 0
,
,case IDOK
,DT_Ok hDlg ;;*
,case IDCANCEL DT_Cancel hDlg ;;*
ret 1
#6
The dialog you posted Gin works perfectly

but i am having trouble doing one modification to it

when i close it, i want to rset the data in the combo

and when i open it back up i want to rget it and put it in the combo

but when it closes i dont know how to get the data, getwintext doesn't work for me

do you think you could modify your example to do that?

Thanks so much
#7
Function Function76
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str cb3
rget cb3 "cb" "\test\test"
if(!ShowDialog("Function76" &Function76 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Name List"
;1 Button 0x54030001 0x4 2 110 48 14 "OK"
;2 Button 0x54030000 0x4 60 110 48 14 "Cancel"
;3 ComboBox 0x54230641 0x0 6 16 96 56 ""
;5 Button 0x54032000 0x0 104 16 18 14 "+"
;6 Button 0x54032000 0x0 104 32 18 14 "-"
;4 Button 0x54020007 0x0 2 2 126 96 "Employee Names "
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 5 ;;+
,str s.getwintext(id(3 hDlg))
,s.trim; if(!s.len) ret
,CB_Add id(3 hDlg) s
,;SendMessage id(3 hDlg) CB_ADDSTRING 0 s ;;use this instead of the above line if CB_Add is unavailable
,
,case 6 ;;-
,int i=CB_SelectedItem(id(3 hDlg))
,if(i<0) ret
,SendMessage id(3 hDlg) CB_DELETESTRING i 0
,
,case IDOK
,int j h=id(3 hDlg); str s1 s2
,for j 0 CB_GetCount(h)
,,CB_GetItemText h j s1
,,s2.addline(s1)
,rset s2 "cb" "\test\test"
,
,case IDCANCEL
ret 1
#8
Thank you, that was perfect Big Grin
#9
Can the names be inserted into an array and then be sorted so you can print or out the names in an alphabetical order or be placed in a phone book (like Notepad) by alphabetical order?
#10
u can sort the names out in the combo by setting the style in dialog editor to CBS_SORT then contents in combo will be sorted
#11
Code:
Copy      Help
,case IDOK
,int j h=id(3 hDlg); str s1
,ARRAY(str) a
,for j 0 CB_GetCount(h)
,,CB_GetItemText h j s1
,,a[]=s1
,a.sort(2)
,s1=a
,out s1
,rset s1 "cb" "\test\test"
#12
That is so rad thanks
#13
Is there any way to incorporate the three new options so that they will be outed with the employee name?

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

str controls = "3 7 8 9"
str cb3 o7Wan o8Wil o9No
rget cb3 "cb" "\test\test"
if(!ShowDialog("Function77" &Function77 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Name List"
;1 Button 0x54030001 0x4 2 110 48 14 "OK"
;2 Button 0x54030000 0x4 60 110 48 14 "Cancel"
;3 ComboBox 0x54230641 0x0 6 16 96 56 ""
;5 Button 0x54032000 0x0 104 16 18 14 "+"
;6 Button 0x54032000 0x0 104 32 18 14 "-"
;7 Button 0x54032009 0x0 148 6 135 12 "Wants you to call"
;8 Button 0x54002009 0x0 148 22 135 12 "Will call back"
;9 Button 0x54002009 0x0 148 38 135 12 "No message"
;4 Button 0x54020007 0x0 2 2 126 96 "Employee Names "
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 5 ;;+
,str s.getwintext(id(3 hDlg))
,s.trim; if(!s.len) ret
,CB_Add id(3 hDlg) s
,;SendMessage id(3 hDlg) CB_ADDSTRING 0 s ;;use this instead of the above line if CB_Add is unavailable
,
,case 6 ;;-
,int i=CB_SelectedItem(id(3 hDlg))
,if(i<0) ret
,SendMessage id(3 hDlg) CB_DELETESTRING i 0
,
,case IDOK
,int j h=id(3 hDlg); str s1
,ARRAY(str) a
,for j 0 CB_GetCount(h)
,,CB_GetItemText h j s1
,,a[]=s1
,a.sort(2)
,s1=a
,out s1
,rset s1 "cb" "\test\test"
,
,case IDCANCEL
ret 1
#14
OK trying this on my own. How can you tell witch option out of 3 has been selected?

Example:
Option first
Option next
Option next

if (option first is selected)
out "Option 1 is selected"
if (option next is selected)
out "Option 2 is selected"
if (option next is selected)
out "Option 3 is selected"
#15
I am just learning but I am getting farther away than I wanted to in understanding arrays and my first question about including the option buttons (will call back) and (no message) and (wants you to call).

I have this but something about the states with option 2 and 3 do not work.

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

str controls = "3 4 5"
str o3Opt o4Opt o5Opt
if(!ShowDialog("Dialog5" &Dialog5 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032009 0x0 10 6 48 12 "Option first"
;4 Button 0x54002009 0x0 10 24 48 12 "Option next"
;5 Button 0x54002009 0x0 10 44 48 13 "Option next"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,Acc o3O=acc("Option first" "RADIOBUTTON" win("Dialog" "#32770") "Button" "" 0x1001)
,int state1=o3O.State()
,Acc o4O=acc("Option next" "RADIOBUTTON" win("Dialog" "#32770") "Button" "" 0x1001)
,int state2=o4O.State()
,Acc o50=acc("Option next" "RADIOBUTTON" win("Dialog" "#32770") "Button" "" 0x1001)
,int state3=o50.State()
,out state1
,out state2
,out state3
,if(state1=1048592)
,,out "Option 1 is selected"
,if(state2=1048592)
,,out "Option 2 is selected"
,if(state3=1048592)
,,out "Option 3 is selected"
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case IDCANCEL
ret 1

as I said I am probably taking the long way around understanding arrays but maybe I will learn something this way.
#16
I found this and it seams to be a very quick way of seeing if a option is selected. I will play with it and see if I can put it in the array.

Macro
Code:
Copy      Help
if(but(id(3 win("Dialog" "#32770"))))
,out "Yes"
else
,out "No"
#17
Option Next and Option Next are being seen as the same button by using the Accessible Object. Changing one to Option Next 1 will do the trick...
In the Dialog Defintion:
;4 Button 0x54002009 0x0 10 24 48 12 "Option next1"

And then in your case IDOK:
,Acc o4O=acc("Option next1" "RADIOBUTTON" win("Dialog" "#32770") "Button" "" 0x1001)
,int state2=o4O.State()
#18
Function Dialog5
Code:
Copy      Help
,case IDOK
,out
,if(but(id(3 win("Dialog" "#32770"))))
,,out "Option first"
,if(but(id(4 win("Dialog" "#32770"))))
,,out "Option Next1"
,if(but(id(5 win("Dialog" "#32770"))))
,,out "Option Next2"

By the way, I don't think this has anything to do with arrays...?!?!
#19
As I said in my earlier post on this subject I think that you are right and I have decided while my desire is to have an answer my question in this post about options and arrays I will be making a new subject post about arrays and options as soon as I have check the spelling and made the new post as clear as I can.


Forum Jump:


Users browsing this thread: 1 Guest(s)