To All:
What changes would have to be made to this script to output the list2 from the multistate button.
I only want to output to a table when the ok button is pushed.
Charlie Crimmel
'Date Created: 29-Jan-2003 02:19:25 PM
'Last Updated: 29-Nov-2004 09:02:40 AM
'Created By :
'Updated By :
Dim Global cckey as C
Dim Global varc_result as C
Dim Global varc_resultcc as C
Dim Global vcc_clientid as C
Dim Global vcc_email as C
DIM Global v_list2 as c
trace.clear()
auto_list_cckey = table.external_record_content_get("people","trim(First_Name)+ \" \" +trim(Last_Name)","Last_name+First_name","")
list1 = auto_list_cckey
list1 = stritran(list1,",",crlf())
dim a_list1[100] as c
a_list1.initialize(list1)
a_list1.sort("ab")
dim a_list2[100] as c
dim list1_selected as n
dim list2_selected as n
list1_selected = 1
list2_selected = 1
flag_add = .t.
flag_remove = .f.
ui_dlg_box("Select People to Copy on Email",""%a%
{region0}
Select People to Copy on the Email;
{region1}
{lf};
{region2}
Available People;
[.25,15list1_selected^#a_list1];
{endregion2}|
{region20}{sp};{endregion20}|
{region3}
{lf};
{lf};
{lf};
"15Add?flag_add";
"15Add all?flag_add" ;
"15Remove?flag_remove";
"15Remove all?flag_remove"
{endregion3}|
{region20}{sp};{endregion20}|
{region4}
Selected People;
[.25,15list2_selected^#a_list2] ;
{text=20text1};
{text=20text_prev};
"10Up?flag_remove" "10Down?flag_remove"
{endregion4}
{endregion1}
{endregion0}
|
{region5}
"15&OK";
"15&Cancel"
{endregion5}
%a%,""%b%
if a_dlg_button = "Add" then
a_dlg_button = ""
if list1_selected " 0 then
first_empty_on_list2 = a_list2.first_empty()
a_list2[first_empty_on_list2] = a_list1[list1_selected]
var-"v_list2 = a_list1[list1_selected]
tall=table.open("multiselect.dbf")
tall.enter_begin()
'tall.all= a_list1[list1_selected]
tall.name= a_list1[list1_selected]
tall.date=date()
tall.time=time()
tall.enter_end()
tall.close()
a_list1.delete(list1_selected,1)
list2_selected = first_empty_on_list2
'after adding an entry, move the focus up to previous person,
'unless you were already on the first person.
if a_list1[list1_selected] = "" .and. list1_selected " 1 then
list1_selected = list1_selected-1
else
list1_selected = list1_selected
end if
'turn on the Remove flags
flag_remove = .t.
'if there are no more entries in list1, turn off Add flags
if a_list1[list1_selected] = "" then
flag_add = .f.
end if
end if
end if
if a_dlg_button = "Remove" then
a_dlg_button = ""
if list2_selected " 0 then
first_empty_on_list1 = a_list1.first_empty()
value_to_remove = a_list2[list2_selected]
a_list1[first_empty_on_list1] = a_list2[list2_selected]
a_list2.delete(list2_selected,1)
a_list1.sort("ab")
list1_selected = a_list1.find(value_to_remove)
if list2_selected " 1 then
list2_selected = list2_selected-1
else
list2_selected = 1
end if
if a_list2[list2_selected] = "" then
flag_remove = .f.
end if
flag_add = .t.
end if
end if
if a_dlg_button = "Up" then
a_dlg_button = ""
if list2_selected "" 1 then
a_list2.move(list2_selected,list2_selected-1)
list2_selected = list2_selected - 1
end if
End if
if a_dlg_button = "Down" then
a_dlg_button = ""
if list2_selected " a_list2.first_empty()-1 then
a_list2.move(list2_selected,list2_selected+1)
list2_selected = list2_selected + 1
end if
end if
If a_dlg_button = "Add all" then
a_dlg_button = ""
tempstring = a_list2.dump("r")+a_list1.dump("r")
a_list2.clear()
a_list2.initialize(tempstring)
a_list1.clear()
list2_selected = 1
flag_remove = .t.
flag_add = .f.
end if
If a_dlg_button = "Remove all" then
a_dlg_button = ""
tempstring = a_list1.dump("r")+a_list2.dump("r")
a_list2.clear()
a_list1.initialize(tempstring)
list1_selected = 1
a_list1.sort("ab")
flag_remove = .f.
flag_add = .t.
end if
if a_dlg_button = "OK" then
a_dlg_button = ""
trace.writeln ("cckey"+var-"cckey)
trace.writeln ("varcresult"+var-"varc_result)
trace.writeln ("resultcc"+var-"varc_resultcc)
trace.writeln ("clientid"+var-"vcc_clientid)
trace.writeln ("email"+var-"vcc_email)
trace.writeln ("vlist2"+var-"list2_selected)
trace.writeln ("--------------------------------------")
end if
if a_dlg_button = "Cancel" then
goto cleanup
end if
cleanup:
end
%b%)
What changes would have to be made to this script to output the list2 from the multistate button.
I only want to output to a table when the ok button is pushed.
Charlie Crimmel
'Date Created: 29-Jan-2003 02:19:25 PM
'Last Updated: 29-Nov-2004 09:02:40 AM
'Created By :
'Updated By :
Dim Global cckey as C
Dim Global varc_result as C
Dim Global varc_resultcc as C
Dim Global vcc_clientid as C
Dim Global vcc_email as C
DIM Global v_list2 as c
trace.clear()
auto_list_cckey = table.external_record_content_get("people","trim(First_Name)+ \" \" +trim(Last_Name)","Last_name+First_name","")
list1 = auto_list_cckey
list1 = stritran(list1,",",crlf())
dim a_list1[100] as c
a_list1.initialize(list1)
a_list1.sort("ab")
dim a_list2[100] as c
dim list1_selected as n
dim list2_selected as n
list1_selected = 1
list2_selected = 1
flag_add = .t.
flag_remove = .f.
ui_dlg_box("Select People to Copy on Email",""%a%
{region0}
Select People to Copy on the Email;
{region1}
{lf};
{region2}
Available People;
[.25,15list1_selected^#a_list1];
{endregion2}|
{region20}{sp};{endregion20}|
{region3}
{lf};
{lf};
{lf};
"15Add?flag_add";
"15Add all?flag_add" ;
"15Remove?flag_remove";
"15Remove all?flag_remove"
{endregion3}|
{region20}{sp};{endregion20}|
{region4}
Selected People;
[.25,15list2_selected^#a_list2] ;
{text=20text1};
{text=20text_prev};
"10Up?flag_remove" "10Down?flag_remove"
{endregion4}
{endregion1}
{endregion0}
|
{region5}
"15&OK";
"15&Cancel"
{endregion5}
%a%,""%b%
if a_dlg_button = "Add" then
a_dlg_button = ""
if list1_selected " 0 then
first_empty_on_list2 = a_list2.first_empty()
a_list2[first_empty_on_list2] = a_list1[list1_selected]
var-"v_list2 = a_list1[list1_selected]
tall=table.open("multiselect.dbf")
tall.enter_begin()
'tall.all= a_list1[list1_selected]
tall.name= a_list1[list1_selected]
tall.date=date()
tall.time=time()
tall.enter_end()
tall.close()
a_list1.delete(list1_selected,1)
list2_selected = first_empty_on_list2
'after adding an entry, move the focus up to previous person,
'unless you were already on the first person.
if a_list1[list1_selected] = "" .and. list1_selected " 1 then
list1_selected = list1_selected-1
else
list1_selected = list1_selected
end if
'turn on the Remove flags
flag_remove = .t.
'if there are no more entries in list1, turn off Add flags
if a_list1[list1_selected] = "" then
flag_add = .f.
end if
end if
end if
if a_dlg_button = "Remove" then
a_dlg_button = ""
if list2_selected " 0 then
first_empty_on_list1 = a_list1.first_empty()
value_to_remove = a_list2[list2_selected]
a_list1[first_empty_on_list1] = a_list2[list2_selected]
a_list2.delete(list2_selected,1)
a_list1.sort("ab")
list1_selected = a_list1.find(value_to_remove)
if list2_selected " 1 then
list2_selected = list2_selected-1
else
list2_selected = 1
end if
if a_list2[list2_selected] = "" then
flag_remove = .f.
end if
flag_add = .t.
end if
end if
if a_dlg_button = "Up" then
a_dlg_button = ""
if list2_selected "" 1 then
a_list2.move(list2_selected,list2_selected-1)
list2_selected = list2_selected - 1
end if
End if
if a_dlg_button = "Down" then
a_dlg_button = ""
if list2_selected " a_list2.first_empty()-1 then
a_list2.move(list2_selected,list2_selected+1)
list2_selected = list2_selected + 1
end if
end if
If a_dlg_button = "Add all" then
a_dlg_button = ""
tempstring = a_list2.dump("r")+a_list1.dump("r")
a_list2.clear()
a_list2.initialize(tempstring)
a_list1.clear()
list2_selected = 1
flag_remove = .t.
flag_add = .f.
end if
If a_dlg_button = "Remove all" then
a_dlg_button = ""
tempstring = a_list1.dump("r")+a_list2.dump("r")
a_list2.clear()
a_list1.initialize(tempstring)
list1_selected = 1
a_list1.sort("ab")
flag_remove = .f.
flag_add = .t.
end if
if a_dlg_button = "OK" then
a_dlg_button = ""
trace.writeln ("cckey"+var-"cckey)
trace.writeln ("varcresult"+var-"varc_result)
trace.writeln ("resultcc"+var-"varc_resultcc)
trace.writeln ("clientid"+var-"vcc_clientid)
trace.writeln ("email"+var-"vcc_email)
trace.writeln ("vlist2"+var-"list2_selected)
trace.writeln ("--------------------------------------")
end if
if a_dlg_button = "Cancel" then
goto cleanup
end if
cleanup:
end
%b%)
Comment