Jerry:
I am trying to write the results of the xdialog selected column to a variable and use trace writeln to view
Then I want to fill a memo field in a table with the selected items
Any help would be appreciated
Charlie Crimmel
'Date Created: 18-Aug-2002 08:21:19 AM
'Last Updated: 22-May-2004 08:10:18 AM
'Created By :
'Updated By :
'The following example displays a dialog with two list boxes,
'Available Cities' and 'Selected Cities'.
'The buttons on the dialog allow the user to select from the list of available cities and
'place them in the selected cities list. The Up and Down buttons allow the user to change the
'order of the cities in the list.
'The script makes extensive use of dialog box events.
dim global var-"list1 as c
dim global var-"vmarketid as n
dim global var-"vmarket as c
var-"list1=""
var-"vmarketid=0
var-"vmarket=""
list1 = "Boston,New York,Chicago,London,Cape Town,Sydney,Toronto,Los Angeles,Tokyo,Johannesburg,Bulawayo,"
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("Market Sectors",""%a%
{region0}
Select the market sectors you would like to add to this record.;
Choose the sectors in the order in which you would like to import them.;
{region1}
{lf};
{region2}
Available Market Sectors;
[.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 Market Sectors;
[.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]
a_list1.delete(list1_selected,1)
list2_selected = first_empty_on_list2
'after adding an entry, move the focus up to previous city,
'unless you were already on the first city.
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
%b%)
I am trying to write the results of the xdialog selected column to a variable and use trace writeln to view
Then I want to fill a memo field in a table with the selected items
Any help would be appreciated
Charlie Crimmel
'Date Created: 18-Aug-2002 08:21:19 AM
'Last Updated: 22-May-2004 08:10:18 AM
'Created By :
'Updated By :
'The following example displays a dialog with two list boxes,
'Available Cities' and 'Selected Cities'.
'The buttons on the dialog allow the user to select from the list of available cities and
'place them in the selected cities list. The Up and Down buttons allow the user to change the
'order of the cities in the list.
'The script makes extensive use of dialog box events.
dim global var-"list1 as c
dim global var-"vmarketid as n
dim global var-"vmarket as c
var-"list1=""
var-"vmarketid=0
var-"vmarket=""
list1 = "Boston,New York,Chicago,London,Cape Town,Sydney,Toronto,Los Angeles,Tokyo,Johannesburg,Bulawayo,"
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("Market Sectors",""%a%
{region0}
Select the market sectors you would like to add to this record.;
Choose the sectors in the order in which you would like to import them.;
{region1}
{lf};
{region2}
Available Market Sectors;
[.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 Market Sectors;
[.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]
a_list1.delete(list1_selected,1)
list2_selected = first_empty_on_list2
'after adding an entry, move the focus up to previous city,
'unless you were already on the first city.
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
%b%)
Comment