[18 Mar 2009] losing focus with Filerequest

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

[18 Mar 2009] losing focus with Filerequest

Post by GMKai »

Note: This is an archived post that was originally sent to the Hollywood mailing list on 18 Mar 2009 16:25:59 +0000

Hello, I have several buttons on my Display. When I use the Function "FileRequest" and answer the requester with OK or Cancel, the "MouseOver"-Event behaves strange. After answering "FileRequest" the only button where Mouseover still works is the button where the "FileRequest" is behind. When moving the mouse over other buttons no MouseOver-Event is triggered. This can be changed when doing LMB into the display.

Is there a way around this, or is this expected behaviour?

CodeSnippets:

Code: Select all

Function p_Hover(msg)
    DisplayTextObject(msg.id,#CENTER,#BOTTOM)
EndFunction

Function p_UnHover(msg)
    Undo(#TextObject,msg.id)
EndFunction 

Function p_prepMenu()
   evtmatch = {OnMouseDown = p_HandlerFunc, OnMouseOver = p_Hover, OnMouseOut = p_UnHover}
   /*1 Load*/
   DisplayBrush(1,10,15)
   MakeButton(1,#SimpleButton, 10,15,24,24,evtmatch)
   /*2 Save*/
   DisplayBrush(2,40,15)
   MakeButton(2,#SimpleButton, 40,15,24,24,evtmatch)
   /*3 Import*/
   DisplayBrush(3,70,15)
   MakeButton(3,#SimpleButton, 70,15,24,24,evtmatch)
EndFunction 
Kind regards GMKai
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[19 Mar 2009] Re: losing focus with Filerequest

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 19 Mar 2009 10:38:01 +0100
Hello, I have several buttons on my Display. When I use the Function "FileRequest" and answer the requester with OK or Cancel, the "MouseOver"-Event behaves strange. After answering "FileRequest" the only button where Mouseover still works is the button where the "FileRequest" is behind. When moving the mouse over other buttons no MouseOver-Event is triggered. This can be changed when doing LMB into the display.
Is the Hollywood window active or inactive? MouseOver etc. events will only work when the Hollywood window has the focus. If an other window is active (e.g. the window of the file requester), no mouse events will be handled.
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

[19 Mar 2009] Re: losing focus with Filerequest

Post by GMKai »

Note: This is an archived post that was originally sent to the Hollywood mailing list on 19 Mar 2009 13:01:11 +0000

Hallo Andreas,

the described behaviour appears after the requester is answered. Thus the requester is closed and can't be active. The focus is at the Hollywood-Window, but Mouse-Over works only for the Button with the requester, Mouse-Over for other buttons does not work until a LMB into the Hollywood-window.
PEB
Posts: 576
Joined: Sun Feb 21, 2010 1:28 am

[19 Mar 2009] Re: losing focus with Filerequest

Post by PEB »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 19 Mar 2009 18:15:32 -0000
Is the Hollywood window active or inactive? MouseOver etc. events will only work when the Hollywood window has the focus. If an other window is active (e.g. the window of the file requester), no mouse events will be handled.
An exception to this rule is if an interval is running. The MouseOver events will be triggered even when the Hollywood window is inactive if you add something like this to the code:

Code: Select all

Function p_InterFunc()
EndFunction
SetInterval(1, p_InterFunc, 40)
The interval frequency determines how quickly the MouseOver and MouseOut events will be noticed with the inactive window. This is probably an unintended "feature" or "bug" (depending on whether or not you like this behavior).
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[19 Mar 2009] Re: Re: losing focus with Filerequest

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 19 Mar 2009 23:24:29 +0100
An exception to this rule is if an interval is running. The MouseOver events will be triggered even when the Hollywood window is inactive if you add something like this to the code:

Function p_InterFunc() EndFunction SetInterval(1, p_InterFunc, 40)

The interval frequency determines how quickly the MouseOver and MouseOut events will be noticed with the inactive window. This is probably an unintended "feature" or "bug" (depending on whether or not you like this behavior).
True... if no one complains about this behaviour then let's call it a feature :-)
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[19 Mar 2009] Re: Re: losing focus with Filerequest

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 19 Mar 2009 23:25:08 +0100
Hallo Andreas,

the described behaviour appears after the requester is answered. Thus the requester is closed and can't be active. The focus is at the Hollywood-Window, but Mouse-Over works only for the Button with the requester, Mouse-Over for other buttons does not work until a LMB into the Hollywood-window.
That's weird. Do you have a script that demonstrates this behaviour? Please try to make it as small as possible :)
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

[20 Mar 2009] Re: losing focus with Filerequest

Post by GMKai »

Note: This is an archived post that was originally sent to the Hollywood mailing list on 20 Mar 2009 09:01:13 +0000

Hallo Andreas,

you get 3 white boxes, the leftmost opens the requester. When clicking "ok" in the requester mouse-over gets corrupted. It still works for the clicked button, but the others don't get highlighted.

here the example:

Code: Select all

@VERSION 4,0
CtrlCQuit(True)
EscapeQuit(False)
EnableLayers()

Function p_HandlerFunc(msg)
     Switch(msg.id)
      Case 1:
        p_LoadProject()
      Case 2:
        p_SaveProject()
      Case 3:
        p_ImportProject()
     EndSwitch
EndFunction

Function p_Main()
   Repeat
        WaitEvent
   Forever
EndFunction

Function p_prepMenu()
    evtmatch = {OnMouseDown = p_HandlerFunc, OnMouseOver = p_Hover, OnMouseOut = p_UnHover}
    /*1 Load*/
    DisplayBrush(1,10,15)
    MakeButton(1,#SimpleButton, 10,15,24,24,evtmatch)
    /*2 Save*/
    DisplayBrush(2,40,15)
    MakeButton(2,#SimpleButton, 40,15,24,24,evtmatch)
    /*3 Import*/
    DisplayBrush(3,70,15)
    MakeButton(3,#SimpleButton, 70,15,24,24,evtmatch)
EndFunction

Function p_MainMenu()
    DisplayBGPic(1)
EndFunction

Function p_LoadBrushes()
    /*LoadBrush(1,"tbimages:backup_g")
    LoadBrush(2,"tbimages:save_g")
    LoadBrush(3,"tbimages:import_g")
    */
    CreateBrush(1,24,24,#WHITE)
    CreateBrush(2,24,24,#WHITE)
    CreateBrush(3,24,24,#WHITE)
EndFunction

Function p_Hover(msg)
    DisplayTextObject(msg.id,#CENTER,#BOTTOM)
EndFunction

Function p_UnHover(msg)
    Undo(#TextObject,msg.id)
EndFunction

Function p_prepStrings()
    SetFontColor(#WHITE)
    SetFont("topaz.font",11)
    CreateTextObject(1,"Load")
    CreateTextObject(2,"Save")
    CreateTextObject(3,"Import")
EndFunction

Function p_LoadProject()
    f$=FileRequest("Load Project","hsmdb")
    If f$ <> ""

    EndIf()
EndFunction

Function p_SaveProject()

EndFunction

Function p_ImportProject()

EndFunction

Function p_NewProject()

EndFunction

p_prepStrings()
p_LoadBrushes()
p_prepMenu()
p_main()                                
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[23 Mar 2009] Re: Re: losing focus with Filerequest

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 23 Mar 2009 23:55:24 +0100
Hallo Andreas,

you get 3 white boxes, the leftmost opens the requester. When clicking "ok" in the requester mouse-over gets corrupted. It still works for the clicked button, but the others don't get highlighted.
Ok, this seems to be a bug. You can circumvent it by using the "OnMouseUp" in your evtmatch table instead of "OnMouseDown", e.g.:

evtmatch = {OnMouseUp = p_HandlerFunc, OnMouseOver = p_Hover, OnMouseOut = p_UnHover}

By the way, you should always use "OnMouseUp" to catch mouse clicks on a button. "OnMouseDown" is only useful if you want to display a highlight state of the button while the mouse button is down. If you only want to catch a mouse click, always use "OnMouseUp" because that triggers when the mouse button is up again. And correct buttons should never trigger before the mouse button is up again! (just try in any GUI you like; a button will not trigger before the mouse button is released)
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

[24 Mar 2009] Re: losing focus with Filerequest

Post by GMKai »

Note: This is an archived post that was originally sent to the Hollywood mailing list on 24 Mar 2009 11:24:12 +0100

Hallo Andreas,

thanks for the hint with using OnMouseUp it works as expected.

Thanks alot. Kai
Locked