EDITTEXT_HELPTEXT usage [SOLVED]



  • On 18/11/2014 at 01:49, xxxxxxxx wrote:

    Hi all,

    I am trying to add a text box in my plugin using this

    self.AddEditText(id=SEARCH_BOX, flags=c4d.BFH_SCALEFIT , editflags=c4d.EDITTEXT_HELPTEXT)

    but i have no idea how to initialize this EDITTEXT_HELPTEXT to "Enter your search string here". So can anyone tell me how can i do that.
    Thanks



  • On 18/11/2014 at 02:41, xxxxxxxx wrote:

    Hello and welcome,

    to set the help text of this gadget simply use the SetString() function with the corresponding flag:

      
    editTextGadget = self.AddEditText(id=2000, flags=c4d.BFH_SCALEFIT , editflags=c4d.EDITTEXT_HELPTEXT)  
    self.SetString(id = editTextGadget,value  = "This is the help text",flags = c4d.EDITTEXT_HELPTEXT)  
    

    best wishes,
    Sebastian



  • On 18/11/2014 at 03:01, xxxxxxxx wrote:

    Thanks a lot.

    I also want to ask one more thing. Can we put an image inside the text box like in search boxes there is a small search icon at the corner?



  • On 18/11/2014 at 05:47, xxxxxxxx wrote:

    Hello,

    I don't think it is possible to add such an image to the actual edit field. But you can create a bitmap button using such an icon next to your text field.

    Best wishes,
    Sebastian



  • On 18/11/2014 at 21:02, xxxxxxxx wrote:

    Hi,

    Thanks for the help.
    I have two more queries.

    1. Can we add a label inside a bitmap button along with an image. I know we can give a tool tip but i want to provide a text and an image inside the button. Is it possible? Also we cannot embed an image with a text because we have to support it in different languages.

    2. From the text field how can we get the text entered after enter key is pressed as we have to launch a command after press of enter.

    Thanks
    Nishant



  • On 19/11/2014 at 05:23, xxxxxxxx wrote:

    Hello,

    the bitmap button custom GUI does not offer such a label. You could use GeGetLanguage() to get the default language and set the image accordingly.

    To catch the "Enter" event simply listen to the gadgets events in the dialog's Command() function. You can check if the currently pressed key is "Enter" with GetInputState() and access the string value of the edit text gadget with GetString():

      
          if id == 2000:  
              # check if "Enter" is pressed  
              resultBaseContainer = c4d.BaseContainer()  
              self.GetInputState(c4d.BFM_INPUT_KEYBOARD,c4d.KEY_ENTER,resultBaseContainer)  
                
              if resultBaseContainer[c4d.BFM_INPUT_VALUE]:  
                  #print full text  
                  print self.GetString(2000)  
    

    For questions no longer related to this thread's original topic please open a new thread. Thanks.

    Best wishes,
    Sebastian



  • On 19/11/2014 at 21:37, xxxxxxxx wrote:

    Thanks ;)


Log in to reply