Results 1 to 7 of 7

Thread: Changing UI defaults automatically/ refreshing the user dialog w/changing values

  1. #1
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,726

    Question Changing UI defaults automatically/ refreshing the user dialog w/changing values

    I have a item name prefix string that I would like to change depending on what TYPE of light a user decides to create.

    That is, if the user choses "POINT LIGHT", the default prefix changes to "Point-".

    In this code snippet, the string requester is preloaded with var2, ="Light-". Depending on which light type is selected, I'd like the dialog to change this preloaded text to something appropriate. Right now of course it is static. How do I get LScript to redraw/refresh the dialog to reflect changing light type?
    Code:
        var1 = "Light-";  //'default' prefix to light name
        c1 = ctlstring("Light Name",var1);
    Thanks.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  2. #2
    automator of tasks xchrisx's Avatar
    Join Date
    Jul 2003
    Location
    Nevada
    Posts
    593
    Blog Entries
    6
    I believe what you want to do is one of those situations where you would have to parse the scene file unfortunately. So what you would have to do is run your script which would parse the current scene file looking for the selected light's ID then read the light type. Once it finds the light type it would be stored in a variable, and finally when creating the requester it would have to look at that variable to set the text string.
    My Lscript Collection | LinkedIn
    3D Generalist IGT

  3. #3
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,726
    Nahh, you misunderstand me: the light type is fully contingent on the script itself, it doesn't reference anything in the existing scene.

    When this script creates a light, it prefaces the name with the light type. Of course, as the user chooses the various types available, I want the preloaded value (string) in the text dialog to change with the type.

    In the dox I've seen some verbiage in Extreme Programmerese that suggests to me that there're methods of forcing the UI to update after its initial drawing, so if the user changes something the UI can change accordingly, but it's convoluted enough I thought I'd throw out a request here first for clarification.

    The 'light types' UI is radio buttons, so if the UI updated everytime a radio button changed state, that would do it.

    (I could explain in the script to the user with explanatory static text, but that's no fun.)
    Last edited by jeric_synergy; 09-30-2012 at 11:20 PM.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  4. #4
    automator of tasks xchrisx's Avatar
    Join Date
    Jul 2003
    Location
    Nevada
    Posts
    593
    Blog Entries
    6
    There are no radio buttons in lscript interfaces, however I believe this is roughly what you are describing (although I am using a popup list).

    Code:
    @warnings
    @version 2.2
    @script generic
    
    
    lightlist = @"Point","Distant","Spotlight"@;
    lightprefixlist = @"Point-","Distant-","Spotlight-"@;
    c2;
    
    generic
    {
        var1 = 1;
        var2 = "string";
    
        reqbegin("My Requester");
        reqsize(276,142);
    
        c1 = ctlpopup("Popup",var1,lightlist);
        c2 = ctlstring("Text Edit",var2);
    		ctlrefresh(c1,"refresh");
    		
        return if !reqpost();
    
        var1 = getvalue(c1);
        var2 = getvalue(c2);
    
        reqend();
    }
    
    
    refresh: value
    {
      setvalue(c2,lightprefixlist[value]);
    }
    My Lscript Collection | LinkedIn
    3D Generalist IGT

  5. #5
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,726
    Quote Originally Posted by xchrisx View Post
    There are no radio buttons in lscript interfaces,
    I refer to all "only one out of multiple choices" UI functionality as radio buttons, since that's the derivation.

    I cut&pasted your code and got an error, "Line 20, callback function refresh() does not exist". I'll look into that when I'm awake.

    Thanks for the example.

    Transcribing the above error made me wish that ALL such text was selectable-- making a screen grab is such a PITA, and so is re-typing something already on the screen.

    +++
    EDIT: Yes, that works perfectly (lesson 4 me: don't try to examine code while asleep.) Cool, thanks, it's gonna be a neat little script.
    Last edited by jeric_synergy; 10-01-2012 at 07:24 AM.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  6. #6
    automator of tasks xchrisx's Avatar
    Join Date
    Jul 2003
    Location
    Nevada
    Posts
    593
    Blog Entries
    6
    There is actually more text in there if you scroll down. It just happened to be cut off by the height of the code box. You need the refresh() udf at the bottom.
    My Lscript Collection | LinkedIn
    3D Generalist IGT

  7. #7
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,726
    Quote Originally Posted by xchrisx View Post
    There is actually more text in there if you scroll down. It just happened to be cut off by the height of the code box. You need the refresh() udf at the bottom.
    Bingo. Exactly what happened.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •