WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Ace3 Options Input Disable Button (https://www.wowinterface.com/forums/showthread.php?t=58229)

Lindrin 09-28-20 08:11 AM

Ace3 Options Input Disable Button
 
Hello,

I have something like this:

Lua Code:
  1. ...
  2. local options = {
  3.     type = 'group',
  4.     args = {
  5.         message = {
  6.             name = Barker.L['LABEL_MESSAGE'],
  7.             desc = Barker.L['DESC_MESSAGE'],
  8.             type = 'input',
  9.             order = 2,
  10.             get = function() Options:GetMessage() end,
  11.             set = function(...) Options:SetMessage(...) end
  12.         }
  13.     }
  14. }
  15.  
  16. function Options:OnEnable()
  17.     Config:RegisterOptionsTable(PANEL_NAME, options)
  18.     CR:RegisterOptionsTable(AddOnName, options)
  19.     CD:AddToBlizOptions(PANEL_NAME, Barker.L['LONG_TAG'])
  20. end

How do I disable the 'okay' button for the message input?

I've tried setting disableButton to true in the options table and accessing the widget via ...message.widget: DisableButton(true). The first complains about an unknown arg and the second says widget is nil.

Seerah 09-28-20 11:20 AM

Why do you want it disabled? Do you only want users to enter in a message of a certain type? If so, see the usage and pattern fields. https://www.wowace.com/projects/ace3...bles#title-3-2

/edit: even if you disabled it, they could always hit "Enter" instead of clicking it. ;)

Vrul 09-28-20 11:23 AM

Quote:

Originally Posted by Lindrin (Post 336929)
How do I disable the 'okay' button for the message input?

You can only disable the entire control when using an options table.
Code:

                message = {
                        name = Barker.L['LABEL_MESSAGE'],
                        desc = Barker.L['DESC_MESSAGE'],
                        type = 'input',
                        order = 2,
                        disabled = function() return true end,
                        get = function() Options:GetMessage() end,
                        set = function(...) Options:SetMessage(...) end
                }


Lindrin 09-28-20 03:38 PM

Quote:

Why do you want it disabled?
It's a usability thing. There's several inputs that are required before the user can hit a 'submit' button. I have a button that's disabled until those values are set. Having the text field pop up an 'okay' button is really misleading.

Quote:

Do you only want users to enter in a message of a certain type?
No. For this we can say it can be any arbitrary text.

Quote:

even if you disabled it, they could always hit "Enter" instead of clicking it.
That's true and I can have that handler just does nothing when the user hits enter but it's misleading and bad UX to have two 'okay' buttons.

Quote:

You can only disable the entire control when using an options table.
That's unfortunate. I don't want the entire widget to be disabled. Only the 'okay' button to not appear when typing. There's no way to access the widget when using an options table so I can call DisableButton(true) on it?

Seerah 09-29-20 11:48 AM

No. It is part of the editbox widget in AceConfig. If AceConfig doesn't fit your needs, you can always create your own UI manually using AceGUI or your own code.

(FYI- AceConfig is just a layer on top of AceGUI to more easily facilitate the creation of and to standardize options windows.)


All times are GMT -6. The time now is 04:47 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI