1. #1
    New Member Follow User Gallery
    Join Date
    May 2017
    Location
    Munich
    Posts
    29

    Default Pre filling text box via script

    Hey everyone!
    I am wondering if there is a way to “pre fill” the textbox that pops up when e.g. Tool:Subtool:Rename is called.
    The idea is to pre fill the rename dialogue with a string of a variable, so the user would only need to press enter.

    An other semi related question:
    Can a tray be created by script?
    I tried to Enable Customize->Create New Menu, but got stuck at the name textbox.
    My hope would be to create a prefilled popup menu (->tray with hotkey), without user assistance of the user.

    Cheers!
    Flo

  2. #2
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Hi Flo,

    You can rename SubTools or Layers using the ZFileUtils dynamic library. See the example zscript in the zip for how to do it. But note that no input from the user is needed - the subtool or layer is simply renamed with no text box appearing.

    It is possible to create and name a custom menu using the same method (after creating an appropriate routine to call the dll function). Again this bypasses any user input - the new menu simply appears at the top of the UI. The problem is that I don't think it's possible to get further than that and fill the new menu with any buttons or sliders. When I've a moment I will have another go but I really don't hold out much hope.

    HTH,

  3. #3
    New Member Follow User Gallery
    Join Date
    May 2017
    Location
    Munich
    Posts
    29

    Default

    Thanks for your reply Marcus!
    I already know about ZFileUtils, but was hoping to give the user the convenience of filling the textbox with his last input, but still allowing him to change it.
    What I did not know though, was that I can use ZFileUtils with every text box. Thank you for pointing that out!

    About the tray;
    What I had in mind, is a “create super cool tray”- button, that would create a tray only when pressed by the user. I guess one of the biggest issues here is, that most of the UI functions are required to be called at top level, right?

    Cheers,
    Flo


    PS.:
    An other only selmi related question :/
    Can switch buttons like "Draw","Move","Scale",.. (that contain an icon) be created via script?

  4. #4
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Hi Flo,

    You could use [StrAsk] to throw up a text entry dialog and pre-fill with whatever you wanted. Then you could use what the user entered to rename the subtool or whatever.

    For your "super-tray" idea, I'm a little confused about exactly what you are trying to do. It's really problematic trying to use zscript for creating any sort of custom ui arrangement. (There are ways around having to call things as "top level" but not, as far as I know, for moving interface items using zscript.)

    You can use [ISwitch] to create orange on/off switches but sadly it is not possible to add icons to them so that they are like "Draw" etc. You can add icons to [IButton] though.

Posting Permissions

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