Hi there,
I was looking at another thread and Peter Wayne's post is something that I would like to use to solve a 'filter' for some lookups. Ideally I would like to have a combo box instead of a list box but that is not really important.
My main question that I have is how do I use Peter Wayne's Xdialog box with all the functionality and make it modeless so that I can put this in the super control.
OK, so I gave this a shot and came up with this code (adapted from Peter Wayne code):
This is Peter Wayne's code for posterity.
I was able to bind the analysis ID and date but that was it. The dialog box work but the filters do not (as you can see in Peter Wayne's post.
I am not quite sure about Xdialog, but it looks very powerful and would love to use it extensively. Any help would be most appreciated. Many thanks.
Wei-Yen Tan
I was looking at another thread and Peter Wayne's post is something that I would like to use to solve a 'filter' for some lookups. Ideally I would like to have a combo box instead of a list box but that is not really important.
My main question that I have is how do I use Peter Wayne's Xdialog box with all the functionality and make it modeless so that I can put this in the super control.
OK, so I gave this a shot and came up with this code (adapted from Peter Wayne code):
Code:
'Put code here to DIM any variables used in your Xdialog. dim shop="" dim poolOwners=" " dim owner="" dim testdate as d=date() dim analysisID as c="" 'IMPORTANT: Do not change the dialog title. ui_modeless_dlg_box(dlgTitle,<<%dlg% {background=<Transparent>} {region} {region} Shop: |[%O={@@}%.30,5shop^#poolShops!chosen]; Owner: |[%O={@@}%.30,3owner^#poolOwners?shop\>""] {endregion}|{region} {sp=3}Analysis ID: |[.16analysisID]; {sp=3}Test Date: |[%DATE%.14testdate] {endregion} {endregion}; {lf}; %dlg%,<<%code% %code%)
Code:
tree=table.external_record_content_get("customer","trim(Bill_State_Region)","Bill_State_Region",\ "unique_key_value()") reslt=ui_dlg_box("Choose customer",<<%dlg% [%S=BLR;D="\"%.40,15node^<tree!navigate]; <OK?(occurs(chr(92),node)=2)> <Cancel>; %dlg%,<<%code% if a_dlg_button="navigate" then a_dlg_button="" children=filter_string(tree,node+chr(92),crlf(),.f.) if children="" then ' this node has not been expanded yet nodeLevel=occurs(chr(92),node) select case nodeLevel=0 ' we just chose a state cities=table.external_record_content_get("customer","trim(bill_city)","bill_city",\ "bill_state_region="+quote(node)+" .and. unique_key_value()") cities=*for_each(tag,node+chr(92)+tag,cities) tree=stritran(tree,node,trim(cities)) case nodeLevel=1 ' we have a state and a city state=word(node,1,"\\") city=word(node,2,"\\") ' tree=stritran(tree,state,node) customers=table.external_record_content_get("customer","Lastname-', '+Firstname",\ "Lastname-', '+Firstname","bill_state_region="+quote(state)+" .and. bill_city="+quote(city)) customers=*for_each(tag,node+chr(92)+tag,customers) tree=stritran(tree,node,trim(customers)) end select end if end if %code%) if reslt="OK" then customer=word(node,3,"\\") ui_msg_box("You chose",customer+crlf()+"from "+city-", "+state) end if
I am not quite sure about Xdialog, but it looks very powerful and would love to use it extensively. Any help would be most appreciated. Many thanks.
Wei-Yen Tan
Comment