Multi Display

Find quick help here to get you started with Hollywood
Post Reply
sinisrus
Posts: 346
Joined: Tue Apr 21, 2015 5:43 pm

Multi Display

Post by sinisrus »

Hello,

I don't understand why nothing happens when I select window or if I close a window, the whole program closes ?! Thanks in advance !

Code: Select all

@DISPLAY 1, {X=50,Y=150, Width=100, Height=100,color=#WHITE}

Win1=CreateDisplay(NIL, {X=50,Width=200, Height=200,color=$FF0000})   OpenDisplay(Win1)
Win2=CreateDisplay(NIL, {X=300,Width=200, Height=200, color=$00FF00}) OpenDisplay(Win2)
Win3=CreateDisplay(NIL, {X=550,Width=200, Height=200, color=$0000FF}) OpenDisplay(Win3)

Function  p_EventFunc(msg)
    Switch msg.action
    CASE "ActiveWindow": DebugPrint(msg.id)
    CASE "CloseWindow":  DebugPrint(msg.id)
    EndSwitch
EndFunction

; listen to these events!
InstallEventHandler({CloseWindow = p_EventFunc, ActiveWindow = p_EventFunc})

EscapeQuit(True)

; Boucle infinie
Repeat
        WaitEvent
Forever
User avatar
jPV
Posts: 493
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Multi Display

Post by jPV »

Window related event handlers are per display, so you must install handlers for each display separately. Now you have only installed them for the last display/window.

This should do the trick:

Code: Select all

; listen to these events!
InstallEventHandler({CloseWindow = p_EventFunc, ActiveWindow = p_EventFunc})
SelectDisplay(1)
InstallEventHandler({CloseWindow = p_EventFunc, ActiveWindow = p_EventFunc})
SelectDisplay(Win1)
InstallEventHandler({CloseWindow = p_EventFunc, ActiveWindow = p_EventFunc})
SelectDisplay(Win2)
InstallEventHandler({CloseWindow = p_EventFunc, ActiveWindow = p_EventFunc})
sinisrus
Posts: 346
Joined: Tue Apr 21, 2015 5:43 pm

Re: Multi Display

Post by sinisrus »

Great, thank you ! I had forgotten
Post Reply