We have detected that cookies are not enabled on your browser. Please enable cookies to ensure the proper experience.
Results 1 to 3 of 3
  1. #1

    All I want to do is...

    ... have a button that's disabled unless there is text in a specific textbox. I'd like to catch an event on the textbox when the user types in it and toggle the button from there, but KeyUp/KeyDown only fire for a limited list of API-defined key commands. Is there any way to do this? I tried playing with the Update event, but I got errors every time I defined a function for it and I'm not sure it's the right place to do this anyway.

  2. #2
    Join Date
    Mar 2007

    Re: All I want to do is...

    Try something like:
      if self.Texttest.Text~=self.SearchText:GetText() then
       -- perform some action here, like setting a button enabled
     self.VisibleChanged = function()
    For an example of this actually working, check out the SearchText control in main.lua from AltInventory - it performs an inventory update and search every time the text in the Search field changes.
    Note: to avoid performance issues, it is fairly important to call SetWantsUpdates(false) when the control is not visible so that you aren't wasting processing time handling updates that aren't important, then call SetWantsUpdates(true) when the control should be visible and getting updates.

    If you're getting an error, you might be accidentally using the wrong syntax to define the event handler like using a colon by accident - ex. "self.Texttest:Update=function ()" is a common error.
    Last edited by Garan; Feb 08 2011 at 06:00 PM.

  3. #3

    Re: All I want to do is...

    Thanks, that worked! I've been looking at AltInventory quite a bit anyway because the plugin I'm playing with needs to look at multiple characters across an account in a similar way; I'm surprised I missed that.



Posting Permissions

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

This form's session has expired. You need to reload the page.