[Gambas-user] Can you esplain the order of message() in a webform

Benoît Minisini gambas at ...1...
Sun Sep 17 00:44:27 CEST 2017


Le 17/09/2017 à 00:05, marco bra a écrit :
> Hi, playing with gb.web component using gambas 3.10.90 daily
> 
> if i create a button to show two dialog message , i get wrong order (2 then
> 1) of displayed message, why  ?
> 
> Public Sub wbcerca_Click()
> 
> Message("1 tot recordset number before selection " & Str(rs.Count))
> 
> '  apriconn(webtextbox1.text)
> 
> Message("2 tot recordset number after selection and redraw of webtablewiew
> " & Str(rs.Count))
> 
> End
> 
> Thank
> Marco
> 

You must understand that you must finish the request to allow 
interaction with the user on the browser.

Your code stack a modal dialog (message #1), and then another modal 
dialog (message #2) on top, before ending the request.

To chain two messages, you have to:

- Display the first message
- Finish the event.
- Handle the Message event on the control that called Message().
- In this handler, you can open the second message box.
- Try to not raise the second message indefinitely.

Public Sub wbcerca_Click()

   Message("1 tot recordset number before selection " & Str(rs.Count))

End

Public Sub wbcerca_Message(Source As Control, Action As String)

   Message.Name = "*" ' Fake name, that prevent the Message to raise again
   Message("2 tot recordset number after selection and redraw of 
webtablewiew" & Str(rs.Count))

End

The Message() behaviour may change in an non-compatible way before 
releasing Gambas 3.11, because it does not work very well. Instead of 
receiving the Source control, we should better receive an arbitrary 
message name. That way you will know for sure which message is being 
displayed inside the Message event handler.

Regards,

-- 
Benoît Minisini




More information about the User mailing list