View Only
  • 1.  Crawl in C# help ...

    Posted 09-23-2021 09:16
    I'm writing C# application to play crawl from .txt text file. It works perfectly when I play it.
    My code is:
       	engine.GetSceneByName("Krol1", out XPScenaCrawl, onLine);
                    if (XPScenaCrawl.IsGroup)
                        XPSceneGroup = (xpSceneGroup)XPScenaCrawl;
                    engine.GetSceneByName("Scene16", out XPScene1, onLine);
                    XPScene1.GetObjectByName("Text1", out XPBaseObject);
                    XPTextObj = (xpTextObject)XPBaseObject;
                    XPTextObj.Text = textZaKrol;
                    XPSceneGroup.Looping = true;
                    XPSceneGroup.SetOnline(framebuffer, 1);

    My question is: How to update/replace crawl text onscreen with the new text?
    I want to periodically update/replace the crawl with the new text, not interrupting the running crawl in the middle, but only after the text has finished.
    I've tried to go through the same code, but when I execute it, the crawl goes off screen , then starts on with the new text.
    I've tried to add new text to "XPTextObj.Text" but it changes immediately not after the old crawl ends.

    Is there a way to achieve this?
    Any help is welcome..

    Dejan Blank

  • 2.  RE: Crawl in C# help ...

    Posted 09-23-2021 17:43
    The XPSceneGroup.Start() method will always restart the Scene Group. You can focus on building a method that updates the text of individual scenes within the group instead.

    Method #1 - Sets the scene group online / offline and starts it.
    Method#2 - Checks which scene is online within the scene group and updates the other scene that is offline accordingly.

     "A" scene and a "B" scene scenario.

    Hope this helps.​

    Wes Petree
    Westin Ryan Media Group, LLC
    United States

  • 3.  RE: Crawl in C# help ...

    Posted 09-25-2021 06:15
    Hi Wes and thanks for your reply.
    I tried your approach "A" scene and "B" scene scenario.
    it seems like good idea, but now I have to know when "A" scene disappears off the screen and then change the text.
    That leads me to "OnSceneState" event triggering and to learn how to trigger.
    In the meantime I found this old post .It seems this is similar to my problem.The sample link is dead, but If somebody has this sample, could you repost? I think this sample has solution for me even it's in VB.
    Any other ideas?

    Dejan R.

  • 4.  RE: Crawl in C# help ...

    Posted 10-04-2021 10:32
    You could do it with one scene. Wait until the scene is changing state to refresh the text.
    static void Main(string[] args)
    	xpEngine engine = new xpEngine();
    	xpScene scene0;
    	xpSceneGroup group;
    	var needRebuild = false;
    	var path = @"D:\temp";
    	var file = "crawl.txt";
    	// Add a watcher to monitor the text file
    	var watcher = new FileSystemWatcher(path);
    	watcher.NotifyFilter = NotifyFilters.LastWrite;
    	watcher.Changed += (sender, e) => {
    		needRebuild = true;
    	watcher.Filter = file;
    	watcher.EnableRaisingEvents = true;
    	if (engine.GetSceneByName("SceneGroup1", out scene0, true) && scene0.IsGroup)
    		group = scene0 as xpSceneGroup;
    		group.OnSceneState += (scene, state) =>
    			// Only update text when needed
    			if (needRebuild)
    				xpBaseObject txt;
    				xpScene txtScene;
    				if (group.GetScene(0, out txtScene))
    					if (txtScene.GetObjectByName("Text1", out txt))
    						(txt as xpTextObject).Text = File.ReadAllText(Path.Combine(path, file));
    						needRebuild = false;


  • 5.  RE: Crawl in C# help ...

    Posted 10-12-2021 12:21
    Hi JOHN,
    Your code was very helpful and put me in a right direction.I adapted it to my GUI APP and it works very well.
    Thanks for your time


    Dejan Blank