Hello,
I am using a client callback routine that seems to mostly work, except
that program flow doesn't seem to continue from the point the function is
called after the Receive function finishes...
...paraphrasing....
var X = "";
button_Click
{
var sTest = ListBox1.value;
DoCallBack(sTest);
------ ReceiveCallback executes fine ------
alert(X);
}
function ReceiveCallback(rValue, context)
{
textbox1.text = rValue;
X = rValue
}
When alert(X) happens, it is always a step behind. For instance, say there
are 5 rows in the list box and the values are 1,2,3,4 and 5. When I click
1, the textbox shows 1, but alert(X) shows an empty string, then I click 2 -
the textbox shows 2, but alert(X) shows 1. If I skip values the alert
always shows th previous value. alert(X) will show the right value if fired
in ReceiveCallback.
How can I continue program flow wirh the current rValue in the button_Click
function?
Thanks

Signature
Matthew.Wells
Matthew.Wells@FirstByte.net
bruce barker - 14 May 2008 21:33 GMT
client callbacks are async. the receive callback will not be called
until after the button click completes.
-- bruce (sqlwork.com)
> Hello,
>
[quoted text clipped - 31 lines]
>
> Thanks
Matthew Wells - 15 May 2008 03:57 GMT
I finally caught that. I thought the ReceiveCallback alert was firing AFTER
the btnClick alert, but it turns out that the btnClick alert fired first,
then thr ReceiveCallback alert fired and the msgbox appeared on top of the
first so the illusion was that I clicked OK on the first then the second
appeared, but in reality, I clicked OK on the second leaving the first one.
I know the intent is to be async, but is there a way to "pause" the btnClick
until the Receive callback finishes? I'm setting a variable in
ReceiveCallBack that I need in btnClick.
Thanks.
> client callbacks are async. the receive callback will not be called until
> after the button click completes.
[quoted text clipped - 36 lines]
>>
>> Thanks
Peter Bromberg [C# MVP] - 15 May 2008 18:57 GMT
No, there wouldn't be a way to "Pause" the button click, because it is the
button's click event handler itself that is actually generating the
callback. So you'll need to revisit your logic to see if you can get what
you need.
Peter
>I finally caught that. I thought the ReceiveCallback alert was firing
>AFTER the btnClick alert, but it turns out that the btnClick alert fired
[quoted text clipped - 49 lines]
>>>
>>> Thanks