Widget ID not recognised

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

Hi everyone,

Bit of a strange one .

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)
        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! 🙂


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.

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!


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.

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! 👏

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.

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

That's fine!

Thanks for trying! Smile