I have a userobject that has multiple controls on it, one of them being a treeviewitem. Lets call this userobject, u_patient_controls. I've inserted this userobject on a tabobject, called u_patient_tab. The u_patient_tab is then put on a window.
The tabobject consists of 26 tabs, 1 for each letter of the alphabet. I have a function on u_patient_controls called of_search(). The purpose of this function, is to select the tab and patient name the user enters from a popup window. The problem I'm having is when it is looping through the treeviewitems it always searches the items in the first tabpage, which is tabpage_a. For example, if tabpage_a is currently selected and the user enters a name that begins with 'N', after the use clicks 'OK' on the popup window, I want to select tabpage_n and loop through the treeviewitem on that tabpage to find the patient. Here is the code in the of_search():
variable declaration.......
//Select the tab associated with the patients last name
lt_tab1 = This.GetParent()
For li_loop = 1 to UpperBound(lt_tab1.Control[])
If lt_tab1.Control[li_loop].Text = ls_last_name then
lt_tab1.SelectTab(li_loop)
exit
end if
next
userobject tp_1
//select the tabpage
tp_1 = lt_tab1.control[li_loop]
tv_patients.SetFocus()
// find the Root Item
ll_root_handle = tv_patients.finditem(RootTreeItem!,0)
// Traverse thru the consequative Items
ll_handle = tv_patients.finditem(ChildTreeItem!,ll_root_handle)
// loop till found
tv_patients.getitem(ll_handle,ltvi)
if ltvi.Data = li_paptrac_number then
tv_patients.selectitem(ll_handle)
else
do while ll_handle <> -1
ll_next_handle = tv_patients.finditem(NextTreeItem!,ll_handle)
tv_patients.getitem(ll_next_handle,ltvi)
if ltvi.data = li_paptrac_number then
tv_patients.selectitem(ll_next_handle)
exit;
else
ll_handle = ll_next_handle
end if
loop
end if
How can I loop through the treeviewitems of the currently selected tab, which under my exaple should be tabpage_n?
Keith
The tabobject consists of 26 tabs, 1 for each letter of the alphabet. I have a function on u_patient_controls called of_search(). The purpose of this function, is to select the tab and patient name the user enters from a popup window. The problem I'm having is when it is looping through the treeviewitems it always searches the items in the first tabpage, which is tabpage_a. For example, if tabpage_a is currently selected and the user enters a name that begins with 'N', after the use clicks 'OK' on the popup window, I want to select tabpage_n and loop through the treeviewitem on that tabpage to find the patient. Here is the code in the of_search():
variable declaration.......
//Select the tab associated with the patients last name
lt_tab1 = This.GetParent()
For li_loop = 1 to UpperBound(lt_tab1.Control[])
If lt_tab1.Control[li_loop].Text = ls_last_name then
lt_tab1.SelectTab(li_loop)
exit
end if
next
userobject tp_1
//select the tabpage
tp_1 = lt_tab1.control[li_loop]
tv_patients.SetFocus()
// find the Root Item
ll_root_handle = tv_patients.finditem(RootTreeItem!,0)
// Traverse thru the consequative Items
ll_handle = tv_patients.finditem(ChildTreeItem!,ll_root_handle)
// loop till found
tv_patients.getitem(ll_handle,ltvi)
if ltvi.Data = li_paptrac_number then
tv_patients.selectitem(ll_handle)
else
do while ll_handle <> -1
ll_next_handle = tv_patients.finditem(NextTreeItem!,ll_handle)
tv_patients.getitem(ll_next_handle,ltvi)
if ltvi.data = li_paptrac_number then
tv_patients.selectitem(ll_next_handle)
exit;
else
ll_handle = ll_next_handle
end if
loop
end if
How can I loop through the treeviewitems of the currently selected tab, which under my exaple should be tabpage_n?
Keith