Time selection in the form of a list?

Former Member
Former Member

Hello.

I would like help changing the time so that it is possible to select the time with <settingConfig type="list">?

GetTime = app.getProperty("TIME"); 

when i do this:

 <setting propertyKey="@Properties.TIME" title="@Strings.TIME">
<settingConfig type="list">
<listEntry value="0">@Strings.00:00</listEntry>
<listEntry value="1">@Strings.00:30</listEntry>
<listEntry value="2">@Strings.01:00</listEntry>
<listEntry value="3">@Strings.01:30</listEntry>
</settingConfig>
</setting>

then I get a message:

ERROR: Rez:34,19: mismatched input '00' expecting {'Method', ID}

How can I easily include a time transformation in the settings.xml file?

Thanks for the advice and type.

  • I think it fails with the symbol translation. A Rez resource becomes a symbol, eg Rez.Layouts.MyMenu is the symbol :MyMenu of the module/class Rez.Layouts

    In similar fashion your string id "00:00" becomes :00:00 which is... the :00 symbol twice? Change the string ID to midnight or 0000 to fix it. Don't use : in string ids in short.

  • Former Member
    Former Member in reply to waterkip

    when i do this:

    <setting propertyKey="@TIME" title="TIME">
    <settingConfig type="alphaNumeric" maxLength="5"/>
    </setting>


    <property id="TIME" type="string">10:00</property>

    so it works, but I have to enter the time manually.

    They need time to be able to choose from a list - sheet.

    How can I achieve this?

  • Yeah. You dont use a rez resource for it in that case. You are using a fixed calue if you will.

    @String is a Rez.String resource, which you can also access directly in the code. 

    I dont think you need a string resource for 00:00 in this use case. The strings make it easier to translate stuff. Digits are in most languages I know digits. So it makes no sense to make them "translatable". If you add a language this @String resource may be different.

    Let's say we have a string resource :watch, this is string id watch with the value watch in yoir strings.xml. We add language support and add Dutch. In resources-dut you now add the string id watch with the value horloge. And Dutch language users would see horloge instead of watch.

    With your numeric values.. it doesnt really make sense. If you still want to do it. Dont use an id with colons. Just remove the colon and make it just alphanumeric. 

  • Former Member
    Former Member in reply to waterkip

    So can you please write me an example of how to correctly change the time?

    When I do
    "0000", so I don't take it into account and the function doesn't work.

    But if I do "00:00", it works for me, but only for manual entry. I want to select a time from the list.

    CONST:

    enum{

    TIME_1 = "00:00",
    TIME_2 = "00:30",
    TIME_3 = "01:00",
    TIME_4 ,= "01:30"
    TIME_5 = "02:00",

    }

    Thank you

  • From how I look at it:

    <setting propertyKey="@Properties.TIME" title="@Strings.TIME">
    <settingConfig type="list">
    <listEntry value="0">@Strings.00:00</listEntry>
    <listEntry value="1">@Strings.00:30</listEntry>
    <listEntry value="2">@Strings.01:00</listEntry>
    <listEntry value="3">@Strings.01:30</listEntry>
    </settingConfig>
    
    <!-- change to -->
    <setting propertyKey="@Properties.TIME" title="@Strings.TIME">
    <settingConfig type="list">
    <listEntry value="0">00:00</listEntry>
    <listEntry value="1">00:30</listEntry>
    <listEntry value="2">01:00</listEntry>
    <listEntry value="3">01:30</listEntry>
    </settingConfig>
    
    <!-- if you want to keep string ids -->
    <setting propertyKey="@Properties.TIME" title="@Strings.TIME">
    <settingConfig type="list">
    <listEntry value="0">@Strings.0000</listEntry>
    <listEntry value="1">@Strings.0030</listEntry>
    <listEntry value="2">@Strings.0100</listEntry>
    <listEntry value="3">@Strings.0130</listEntry>
    </settingConfig>
    
    <!-- in strings.xml -->
    <string id="0000">00:00</string>
    

    But I would not use the strings.xml for this, as said, it is not something that is "translateable", a 100km is 100km also in China. Although they probably have a different writing for the km part, that you can put in strings.xml.