How do I set ":" option for time?

Former Member
Former Member
Ok, I am trying create an option for users to use ":" as a time separator. So basically, when it is true, the hour and minute will have ":" in between them. But when it is false, the minute should start from where the ":" should have been and there should not be a space between hour and minute. What I have done (which doesn't work) is this:

1. Created the relevant stuff on properties.xml

<properties>
<property id="Separator" type="boolean">true</property>
</properties>
.
.
.
<string id="Separator">Show Time Separator?</string>
.
.
.
<setting propertyKey="@Properties.Separator" title="@Strings.Separator">
<settingConfig type="boolean" />
</setting>


But what should I set within the xxxView.mc file itself? I have tried

if ((App.getApp().getProperty("Separator")) == true) {Colon = ":";}
var sep = Colon;


Which works when it is true, but gives me two big blank space when it is false. See picture:
  • Looks like if you don't use the colon, you are trying to use something else (a space, null,?)

    what you may want to do is something like this:
    var sep="";
    if (App.getApp().getProperty("Separator")) {sep= ":";}

    as I think you were just using whatever was in "Colon" before. The boxes indicate something that's not in the font you are using.

    You could also do:
    var sep=(App.getApp().getProperty("Separator"))? ":" : "";

    but the first way may make it a bit clearer as to what's happening.
  • Yes, in that line, there's condition. The ? shows the options, and the : that's not in quotes separates the two options

    so it's kind of like:

    if(x) then sep=":" else sep=""