After check @edText highlight Report Row then execute @deRvrSelect event

Started by bmclellan, May 13, 2020, 01:11:11 PM

Previous topic - Next topic

bmclellan

Hello,

I have an input that once the 10th character is hit, I do an array search, find the entry and then show it selected in my ReportView.
Once this happens, I'd like to send an event to kick off the deRvrSelect on the control that was highlighted to force that code to execute.

I was getting kind of lazy and didn't want to copy the routine (or make a function) that kicks off when I physically click the row, as opposed to when I search on it instead. Does anyone know if this is possible?


case @deRvrSelect
   if DialogControlID == "rv_Stores" then
;Do a pile of stuff here
end if
return -2

case @deEdText
if DialogControlID == "ebStoreNumberLookup" then
ebStoreNumberLookup = DialogControlGet(Handle,"ebStoreNumberLookup",@dcText)
rv_Stores = DialogControlGet(Handle,"rv_Stores",@dcContents)

if Strlen(ebStoreNumberLookup) == 10 then
result = Arraysearch( rv_Stores, ebStoreNumberLookup, 0, 0, 0, ArrInfo(rv_Stores,1)-1)
if result > -1 then
DialogControlState(Handle,"rv_Stores",@dcsSetFocus,'') ; Clear the invisible bit
DialogControlSet(Handle,"rv_Stores",@dcSelect,ebStoreNumberLookup)
DialogControlSet(Handle,"rv_Stores",@dcScroll,ebStoreNumberLookup)

;Now go an execute @deRvrSelect - DialogControlID "rv_stores"
end if
end if
end if
return -2




Thanks!
Barry

td

You could try something with the WIL mouse functions to simulate a user's mouse click. But unless I am misunderstanding something (always a possibility), you would be better off encapsulating your @deRvrSelect event selection code in a UDF/S and just calling from your  @dcSelect event at the appropriate time.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

bmclellan

Thanks!

You are correct, I could do it in a UDF/S, but was hoping I could just easily raise some kind of click event after I set focus without having to modify my code.


Have a great day!
Barry

td

Encapsulating existing code in a UDF/S and calling the same is a relatively easy modification and more reliable than trying to imitate user input in some fashion.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade