[Gambas-user] Strange gb.qt5 error

T Lee Davidson t.lee.davidson at gmail.com
Fri Jan 18 21:00:08 CET 2019


I don't know why you can't use popup windows nor why a Message.Question is not sufficient for a Yes/No question. But, you know
the constraints of your project.

I am able to popup a modal form in the Button1_Click sub with no problem.

Maybe try something like this:

Public Sub Button1_Click()

  Form1.ShowModal

End

Public Sub Form_KeyPress()
  If Key.Code = Key.F1 Then
    Stop Event
    Button1_Click
  Endif
End

That works for me even without "Stop Event". So, if that doesn't help, then there may indeed be an issue with your component.


___
Lee


On 1/18/19 2:30 PM, Marco Ancillotti wrote:
> Also for me using a message.question but I can't use popup windows so I made a component that do the same using a container that
> popup in the active window.
> It's like a messageview but with two button with yes/no.
> 
> It works perfectly but when I put it in a function called by a keypress event I get the error.
> 
> If needed I can post the code.
> 
> 
> 
> Il 18/01/19 20:25, T Lee Davidson ha scritto:
>> It works fine for me with a Message.Question dialog on v3.12.90.
>>
>>
>> ___
>> Lee
>>
>>
>> On 1/18/19 2:18 PM, Marco Ancillotti wrote:
>>> I made a function and moved the code but I get the same error.
>>> now I have:
>>>
>>> Public Sub Button1_Click()
>>>    apri()
>>> End
>>>
>>> Public Sub Form_KeyPress()
>>>    If Key.Code = Key.F1 Then apri()
>>> End
>>>
>>> the apri sub call a module that open a form with a simple yes/no question, works perfectly when I click button1 , hangs when I
>>> hit F1.
>>>
>>>
>>> Il 18/01/19 20:03, T Lee Davidson ha scritto:
>>>> Form_KeyPress is an event handler. Button1_Click is also an event handler. An event handler should not be called from within
>>>> another event handler.
>>>>
>>>> I suggest moving the code that is in Button1_Click to a separate routine that can be called from either of the two handlers.
>>>>
>>>>
>>>> ___
>>>> Lee
>>>>
>>>>
>>>> On 1/18/19 1:46 PM, Marco Ancillotti wrote:
>>>>> Hi ,
>>>>>
>>>>> I have a keypress form code that run a Button_click when someone hit F1 , somethink like:
>>>>>
>>>>> Public Sub Form_KeyPress()
>>>>>     If Key.Code = Key.F1 Then Try Button1_Click()
>>>>> End
>>>>>
>>>>> When I hit button with mouse everythink works well but when i press F1 I get:
>>>>>
>>>>> gb.qt5: warning: calling the event loop during a keyboard event handler is ignored
>>>>>
>>>>> and program hangs , no way to close , only stop button on ide stop it.
>>>>>
>>>>> Any idea?
>>>>>
>>>>> thank's in advance,
>>>>>
>>>>> Marco.
>>>>>
>>>>>
>>>>>
>>>>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>>>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>>>
>>>
>>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
> 
> 
> 
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----


More information about the User mailing list