You're reading ...
Traincontroller

Traincontroller 50: Change the Content of a Text Field by Using a Text Variable

 

Text in a text field on the switchboard can dynamically be updated, triggered by events that take place somewhere on the layout. We use a text-variable to accomplish this.

  1. Create a global variable: Menu Windows > Explorer Window > Variables > right click > New Object > Variable
  2. Create a text field on the switchboard and add the variable to it: type %V … TC will add [?]. Double click %V[?] and select the variable you want to display from the list.
  3. In any element that can contain Operations (push button, switch, flagman, sensor, signal, schedule start or –finish) add: Control Flow Operations > Access to Variable > change > select your variable > =(Assignment) > type the text you want to display.

TRAIN NAMES
If we’d want to display a train name, we can not use the train names that were given when the trains were created, alas these can not be loaded  into a variable. The video shows two options how we can work around this.

 

 

About RudyB

Hobbyist

Discussion

18 thoughts on “Traincontroller 50: Change the Content of a Text Field by Using a Text Variable

  1. Hi Ruud,

    Very cool Traincontroller videos. Very helpfull.

    In this video you explain how to use variable text, but is it also possible
    to use variable images (gif files flashing lights f.i.) or variable sign
    aspects ( 2 red signs flashing, or a yellow light flashing) I have a gate crossing
    with 3 lights, and 2 aspects (train is coming 2 flasing red lights, gate is free
    1 flasing yellow light) I would like to show this on my switchboard. Is this
    possible and if yes how is this done?

    Thanks in advance for your help

    Wil

    Like

    Posted by W.van der Wee | January 9, 2021, 09:20
    • You could make a blinking light in TC using a signal symbol and place instructions in the Operations tab that tell it to switch color, Delay, switch colour, Delay, go to top.
      It might be possible using HTML to create a blinking background (see w3schools.com for info and the HTML instruction set) but it’ll take some experimenting because not all HTML instructions are included in TC and there’s no documentation which are or are not.

      Like

      Posted by RudyB | January 9, 2021, 09:47
  2. Hi
    Your Videos are realy cool and helpful
    Im also interested how you make the Station-Board. Would you send me the File for the html-Boards in Video #50?
    greetings, Sascha

    Like

    Posted by Sascha Liebscher | August 13, 2018, 09:55
    • Hi Sascha. I don’t have that file anymore, it was just an example. The board itself was a background image, photoshopped to the exact needed dimensions. The text was simple white text with a ‘padding’ to align it at the right spot.

      Like

      Posted by RudyB | August 13, 2018, 10:10
      • Hi, i have it. My problems was the variables. its a heavy theme. I dont understand it. But now i have it and it works

        Sascha

        Like

        Posted by Sascha Liebscher | August 17, 2018, 12:23
  3. Ruud I have down loaded the Arduino servo decoder code But for some reason it will not compile.
    “This report would have more information with
    “Show verbose output during compilation”
    enabled in File > Preferences.
    Arduino: 1.0.6 (Windows NT (unknown)), Board: “Arduino Uno”
    RB_DCC_Decoder_Servo.ino: In function ‘void setup()’:
    RB_DCC_Decoder_Servo:123: error: ‘DCC’ was not declared in this scope
    RB_DCC_Decoder_Servo.ino: In function ‘void loop()’:
    RB_DCC_Decoder_Servo:141: error: ‘DCC’ was not declared in this scope”

    not familiar with C++ any comments would be of help

    Thanks

    Alan

    Like

    Posted by Alan Whitworth | March 30, 2018, 15:38
  4. Hi ruby can you please email your latest train controller file. I am interested in the HTML code for the station boards from video 50.

    Cheers Darren johns

    Email:
    ndjohnsy1@bigpond.com

    Like

    Posted by Darren johns | March 2, 2018, 18:08
  5. Hi Rudy,
    This is further to why I could not get more engines and schedule. I was clicking only New Train window which was creating more train windows and there is a small triangle next to the train picture where one can select the engine created. I did not notice this triangle and also Create engine in another Edit tab.
    Also as you rightly pointed out, I did not get into Edit mode before opening Dispatcher. So my Create Schedule button was greyed out.
    Thanks for your reply,
    Regards,
    Dilip

    Like

    Posted by Dilip | February 8, 2018, 13:21
  6. Thanks, Rudy for your reply. I posted earlier that I found it by playing with it yesterday for few hours and clicking all over the place. Your videos are great! You are doing such a marvellous job for newbies like us. I really admire you.
    Regards,
    Dilip

    Like

    Posted by Dilip | February 8, 2018, 12:28
  7. Hi, I am able to solve the issues mentioned after playing with the software for some more time.

    Like

    Posted by Dilip | February 8, 2018, 12:22
  8. Hi Rudy,
    Just to add to my earlier comment: I followed the quick start guide and could run train in various modes but could not create more than one engine and when I open Dispatcher window, it is blank; so I could not create any schedule. The menu commands in TC4 and TC9 are different. I shall be grateful if you can help.
    Regards,
    Dilip

    Like

    Posted by Dilip | February 7, 2018, 11:40
    • Hello Dilip. I do not have TC Bronze installed so I can’t help with the missing menu items. It is possible to create more than one engine. If you have version 9 demo installed, you should be in edit mode and then click the ‘Edit’ menu top open the Edit ribbon. There should be a ‘Create Engine’ button in there. You could also go to the classic menu (see one of my latest vodeos) … there should be a ‘Train’ menu with ‘Create Engine’ in it.

      WIth the dispatcher windo it is normal that you sdo not see your track at fiirst. you need to click on ‘Create Schedule’ first (also to be found on the Edit ribbon) and also the ‘show main diagram icon on the toolbar right abovethe dispatcher window must be in the right state (just toggle it to see what happens). Hope this helps …

      Like

      Posted by RudyB | February 8, 2018, 10:28
  9. Is there really nothing but design with html in version 9. If there is no technology, it’s not worth updating. All you’ve shown up to now is just a bunch of mildew

    Like

    Posted by Bjarne Pedersen | February 3, 2018, 16:27
  10. hi Rudy thank you for all the help its great ..i know you dont have a turntable on your layout but could you help me having a all-full time fingering it out .best of regards ps a small movie would work great for a lot of Canadians lol thank you Greg Whayman

    Like

    Posted by greg whayman | February 2, 2018, 01:01
    • I might do a video on a turntable soon.

      Like

      Posted by RudyB | February 4, 2018, 12:42
      • Hi Rudy, I am a 66 year old newbie entering this hobby field. I watched and found your videos till TC11 very useful. But they were using TC Gold version 4. I am playing with TC9 Bronze demo version and may buy this but in TC9 I have two problems. I shall be very grateful if you can help. I posted in the Freiwald forum but no reply. I have two main issues as given below.
        1. After creating first train, when I click on ‘New Train’ command, it shows me the first one created and doesn’t add new train in the Engine+Train window. When I click few times, it shown old one only. Your video is based on Gold4 which has menu: Train->Create an engine. You keep on clicking and get 4 trains. But in Bronze9, there is no such menu. How to create more trains in Bronze9?
        2. Gold4 version has menu: Schedule->Create Schedule. So you can create new schedule. In Bronze9’s Dispatcher window or anywhere on the ribbon, there is no Create Schedule button. But I could run the Schedule1 in the example but could not create new one in the example or my switchboard. When I open Dispatcher window in my own switchboard, it doesn’t display any diagram on the right side. How to create new schedule in Dispatcher in Bronze9?
        Please please help. My email id: dvbattul@yahoo.com Or you can reply here.
        Regards,
        Dilip

        Like

        Posted by Dilip | February 7, 2018, 06:46

Leave a comment

Archive of all posts