Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Widget ID not recognised

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 961 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 01/02/2018 at 02:33, xxxxxxxx wrote:

      Hi everyone,

      Bit of a strange one Confused.

      My multi-line text box ID is not being recognised when running in the Command definition. The widget is created in the dialog correctly.
      All other widgets run fine...

      I don't think I'm doing anything incorrectly, but you never know 😂.

      Here's a snippet of the code:

      STATUS_ID = 1003
        
      class checkOutDialog(gui.GeDialog) :
        
          def CreateLayout(self) :
        
              # Status line widget
              self.GroupBegin(10003, c4d.BFH_SCALEFIT, 1, title = 'Group Status Line')
              self.AddMultiLineEditText(STATUS_ID, c4d.BFH_SCALEFIT, 0, 200, c4d.DR_MULTILINE_READONLY)
              self.GroupEnd()
        
              return True
        
          def Command(self, id, msg) :
              
              # Scroll Status TextBox into last line    
              if id == STATUS_ID: ----> Not returning True for this condition???
              
                  text = self.GetString(STATUS_ID) 
                  bc = c4d.BaseContainer(c4d.BFM_EDITFIELD_GETCURSORPOS)
                  pos = checkOutDialog().SendMessage(STATUS_ID, bc)
                  print pos
        
              return True
        
      
      

      Thank you very much in advance! 🙂

      Andre

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 02/02/2018 at 03:59, xxxxxxxx wrote:

        Hi Andre,

        you create the MultiLineEditText as read only. So, there's no real reason to receive a command from the widget.
        If you remove the DR_MULTILINE_READONLY flag, Command() will be called and your condition will work. Just be aware, Command() is called only after the user has finished the edit (like pressing Tab or clicking somewhere else) and not for every single key press.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 02/02/2018 at 09:12, xxxxxxxx wrote:

          Hi Andreas,

          Thank you very much! That did the trick! 🙂

          Still in subject, is there other ways of scrolling down the multi-line widget with the DR_MULTILINE_READONLY flag included?

          Thank you in advance!

          Andre

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 02/02/2018 at 10:07, xxxxxxxx wrote:

            You mean, another method than the user using the scroll bar or mouse wheel?

            In general you can use SetMultiLinePos() to position the cursor. Unfortunately this does not work as expected during CreateLayout() or InitValues(). The cursor is positioned correctly, but the text field doesn't scroll to this position. When being used as reaction to for example a button press in Command() it works as expected, though. I'll see if I can find a solution for the initialization phase on Monday.

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 05/02/2018 at 04:47, xxxxxxxx wrote:

              Hi Andreas,

              Don't worry to much about it! unless you think it's valuable of your time for other people as well.
              I've managed to make it work for me.

              I was triggering a MessageDialog Box that prevented the focus to stay with the text box, thus returning the position of the cursor as None.

              By removing it and just add a "FINISHED" line into the text box, it allowed the position to be set at the end, as so:

              prevMsg = self.GetString(STATUS_ID)
              msg = prevMsg + "FINISHED!"
              self.SetString(STATUS_ID, msg)
                          
              text = self.GetString(STATUS_ID)
              self.SetMultiLinePos(STATUS_ID, len(text), len(text))
              

              This made the change correctly even with c4d.DR_MULTILINE_READONLY flag, which is a bonus.  🙂

              Either way, I appreciate all the help and time you spent.

              Thank you very much indeed! 👏

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 05/02/2018 at 08:48, xxxxxxxx wrote:

                Unfortunately no good news, I don't think there's a way to make the MultiLineEditText scroll down during initialization. Sorry.

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  On 07/02/2018 at 06:57, xxxxxxxx wrote:

                  That's fine!

                  Thanks for trying! !Smile[URL-REMOVED]


                  [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post