Development Question: No Resources ?? (1 Viewer)

steve42

MP Donator
  • Premium Supporter
  • November 9, 2008
    79
    30
    Ettlingen
    Home Country
    Germany Germany
    Hi,

    I'm about to develop a plugin that uses more than one window (like the GuiControlsDemo plugin). When the plugin starts
    up and shows its first window, everything is fine.

    But when switching to the second window the first time, some graphic resources are missing (the background image, the buttons images).

    The following code is used:
    Code:
    IPSWindow ipswin = new IPSWindow( id, skin );
    if( ipswin.Init() ) {
         GUIWindow window = (GUIWindow)ipswin;
         GUIWindowManager.Add(ref window);
         GUIWindowManager.ActivateWindow(id,false);
    } else {
         Log.Error("Error when calling init");
    }

    The Init method loads the skin files as usual. When the code is executed the second time (user navigates again to the second window) all graphics are loaded as expected.

    Any suggestions? Used MP version is 1.1.0.

    Steve
     

    Attachments

    • first-window.jpg
      first-window.jpg
      13.7 KB
    • second-window.jpg
      second-window.jpg
      11.1 KB
    • second-window-2nd-time.jpg
      second-window-2nd-time.jpg
      13.8 KB

    steve42

    MP Donator
  • Premium Supporter
  • November 9, 2008
    79
    30
    Ettlingen
    Home Country
    Germany Germany
    IPSWindow is derived from GUIWindow. An instance of this class handles a gui window as usual. In its Init method it loads a arbitrary skin file (the skin parameter) and uses id as its window id.

    The code is called in a OnClick-Handler i.e. when the user clicks a button.

    The CTOR looks like this:
    Code:
            public IPSWindow(int id, string skin)
            {
                this.winId = id;
                this.skin = skin;
            }

    The Init method like this:
    Code:
            public override bool Init()
            {
                bool r = Load(GUIGraphicsContext.Skin + "\\" + this.skin);
                Log.Debug("IPSWindow::Init loading skin {0}, success {1}", this.skin, r );
                return r;
            }

    steve
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Not sure why you are trying to load a second window this way.

    Any reason why you don't just use something like
    Code:
    GUIWindowManager.ActivateWindow((int)Window.WINDOW_MUSIC_PLAYLIST);

    ?
     

    steve42

    MP Donator
  • Premium Supporter
  • November 9, 2008
    79
    30
    Ettlingen
    Home Country
    Germany Germany
    The reason is: I want to build a single plugin, that has the possiblity to handle as many windows as configured not just one. and not just the ones that are predefined.

    You just need to create another skin file (something.xml) and tell the plugin "you can use this skin file with this id, so load it". The control demo plugin does something similar: it switches the windows to show different sets of controls. The code of this control demo plugin works mine shows this weird black screen or sometimes a font missing.
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    right so you are dynamically creating pages and you do not know how many pages there are going to be?

    I am a little confused though as you are setting a window ID in the constructor but the skin file needs to have the window ID embedded in it. How are you solving this?
     

    steve42

    MP Donator
  • Premium Supporter
  • November 9, 2008
    79
    30
    Ettlingen
    Home Country
    Germany Germany
    you are right. the id in the ctor params is needless. it must always be the same as in the skin file.

    but in my tests the ids fit, so this isn't a problem, I think.
     

    Users who are viewing this thread

    Top Bottom