activate a second window please help (1 Viewer)

Zarra

Portal Member
March 24, 2008
26
0
Home Country
Germany Germany
i m writing a plugin and i have some question please help me because i m trying for two week and i dont find a

solution:

1. How can i Activate new window i use this Method

GUIWindowManager.ActivateWindow(8110, true);

but it didint work, i become a black window:

This is the code for the second window what i try to call from the first window

HTML:
  class Media2: GUIWindow
    {

        public Media2()
        {

        }
        public override int GetID
        {
            get
            {
                return 8110;
            }
            set
            {
                base.GetID = value;
            }
        }

        public override bool Init()
        {
            return Load(GUIGraphicsContext.Skin + @"\Oerflaeche2b.xml");
        }

        protected override void OnPageLoad()
        {
            MessageBox.Show("Oberflaeche2 " );
            base.OnPageLoad();
        }

        protected override void OnPageDestroy(int new_windowId)
        {

            base.OnPageDestroy(new_windowId);
        }

        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {

            base.OnClicked(controlId, control, actionType);
        }

        public override bool OnMessage(GUIMessage message)
        {
            if (message.Message == GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS || message.Message == GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS_CHANGED)
            {

            }
            return base.OnMessage(message);
        }
    }

please help me and thank you

please havent sonme one any idea, i m waiting
 

jburnette

Portal Pro
August 24, 2006
758
116
Kentucky
Home Country
United States of America United States of America
To activate a second window from another one, you would do something like this.

Media2 Media2 = new GUIWindowManager.GetWindow(8110)
GUIWindowManager.ActivateWindow(8110)

That should work for you. You may need to call Media2.Process in between those two as well, but I'm not positive if that's required. The syntax may be a bit off but you see what I'm getting at.
 

Zarra

Portal Member
March 24, 2008
26
0
Home Country
Germany Germany
i try but i come evry time back to the home Windows.
MP dont load the new XML
 

jburnette

Portal Pro
August 24, 2006
758
116
Kentucky
Home Country
United States of America United States of America
Do you have a skin file for that window that has its window id set to <id>8110</id> at the top of the skin file?
 

Zarra

Portal Member
March 24, 2008
26
0
Home Country
Germany Germany
yes i have a second XML Datei with the same ID


<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<window>
<id>8110</id>
<defaultcontrol>2</defaultcontrol>
<allowoverlay>yes</allowoverlay>
<controls>
<control>
<description>BackGround</description>
<type>image</type>
<id>1</id>
<posX>0</posX>
<posY>0</posY>
<width>720</width>
<height>576</height>
<texture>background.png</texture>
</control>

<!-- anfang -->
<control>
<description>Header</description>
<type>image</type>
<id>1</id>
<posX>0</posX>
<posY>0</posY>
<width>720</width>
<height>70</height>
<texture>AGT_PluginHeader.png</texture>
</control>
<!-- Ende -->
<control>
<description>an Image</description>
<type>image</type>
<id>1</id>
<posX>75</posX>
<posY>370</posY>
<texture>hover_my videos.png</texture>
</controls>
</window>

that why i cant understand where are the mistake
 

Zarra

Portal Member
March 24, 2008
26
0
Home Country
Germany Germany
if (control == initial)
{
// go to the second GUI

BodyMedia2 bd = new BodyMedia2();
bd.Init();
//BodyMedia2 bd = new BodyMedia2();
//bd.OnPageLoad();

// GUIWindowManager.GetWindow(8110);
// GUIWindowManager.ActivateWindow(8110);
//this.Visible = false;
Load(GUIGraphicsContext.Skin + @"\Oberflaeche2.xml");
ClearAll();

//ClearAll();
//GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(0);
//GUIWindowManager.GetWindow(8110);

//MessageBox.Show( GUIWindowManager.IsOsdVisible());
//GUIWindowManager.ActivateWindow(8110, true);
//Load(GUIGraphicsContext.Skin + @"\Oberflaeche2.xml");
//s.Init();
// ClearAll();
}


you see i use all Method : )
 

jburnette

Portal Pro
August 24, 2006
758
116
Kentucky
Home Country
United States of America United States of America
How about

BodyMedia2 bd = new GUIWindowManager.GetWindow(8110);
GUIWindowManager.ActivateWindow(8110)

You're getting the black screen, I think, because of this call:

Load(GUIGraphicsContext.Skin + @"\Oberflaeche2.xml");

Which should be handled for you when you call GetWindow (since you're already loading it from your second class).
 

Zarra

Portal Member
March 24, 2008
26
0
Home Country
Germany Germany
With this Sytax BodyMedia2 bd = new GUIWindowManager.GetWindow(8110);
i become a mistak
Without this Syntax Load(GUIGraphicsContext.Skin + @"\Oberflaeche2.xml");
it jump to the Home window : (
 

cybrmage

Portal Pro
May 30, 2007
498
86
Home Country
Canada Canada
<!-- Ende -->
<control>
<description>an Image</description>
<type>image</type>
<id>1</id>
<posX>75</posX>
<posY>370</posY>
<texture>hover_my videos.png</texture>
</controls>
</window>

that why i cant understand where are the mistake

Your skin file is bad!!!

You need a closing statement for each control statement... you are missing one at the end...

The section I quoted above should be....
Code:
     <!-- Ende -->  
     <control>
      <description>an Image</description>
       <type>image</type>
       <id>1</id>
       <posX>75</posX>
       <posY>370</posY>
       <texture>hover_my videos.png</texture>
      </control>
     </controls>
</window>






if (control == initial)
{
// go to the second GUI

BodyMedia2 bd = new BodyMedia2();
bd.Init();
//BodyMedia2 bd = new BodyMedia2();
//bd.OnPageLoad();

// GUIWindowManager.GetWindow(8110);
// GUIWindowManager.ActivateWindow(8110);
//this.Visible = false;
Load(GUIGraphicsContext.Skin + @"\Oberflaeche2.xml");
ClearAll();

//ClearAll();
//GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(0);
//GUIWindowManager.GetWindow(8110);

//MessageBox.Show( GUIWindowManager.IsOsdVisible());
//GUIWindowManager.ActivateWindow(8110, true);
//Load(GUIGraphicsContext.Skin + @"\Oberflaeche2.xml");
//s.Init();
// ClearAll();
}


you see i use all Method : )

If you are loading a new skin into an existing window while you are using it... You will need to force the window manager to reload the page....

Code:
            Load(GUIGraphicsContext.Skin + @"\Oberflaeche2.xml");
            Restore();
            LoadSkin();

Without the two extra commands, the window manager will not actually load the new skin because the skin is window is already loaded... I found this out the hard way... (The CybrDisplay plugin uses dynamically generated skin files for the GUI setup).

Regards,
CybrMage
 

Users who are viewing this thread

Top Bottom