How to Access the Values of GeDialog Gadgets

split from this thread


I made some unsuccessful researches about how to access to the selected value of a CUSTOMGUI QUICKTABRADIO declared in a Resource File. I found some examples on how to create and use a QuickTab using GeDialog, but none using .RES.

@ferdinand, based on the ID_CA_MUSCLE_OBJECT_STATE you wrote above, how do you access to the LONG ID_CA_MUSCLE_OBJECT_STATE value inside the Execute() or Message()? I didn't fount any way to get the right message update when clicking the options on the Cycle.

Until now I totally failed to get the selected value from it, I only get 0 when the first element of the cycle is clicked and nothing on the others.

Any clue or example would be more than welcome!

Thanks a lot

Hello @mocoloco,

thank you for reaching out to us. I have forked your question from How to Highlight a Button since it is a new question which does constitute a new topic. I am also currently on vacation which means that you will have to address the rest of the team to get support in a timely fashion (addressing just me and hiding your question in an older topic was probably what got your question being overlooked).

About your question(s):

  1. You can find out more about dialog resources, i.e., defining a dialog in a file and not programmatically, in Resource Files Manual and Dialog Resource. Both manuals are part of our C++ documentation but do translate quite directly to Python since resource files are mostly a language agnostic topic. It also remains unclear to me if you actually want to define a dialog or a node since *"using .RES" does not distinguish the two. In either case the resource snippet I did post in the other thread could be used as a template for both cases.
  2. I am also not quite sure how the second part of your question is meant. You usually do react to dialog input events in GeDialog.Command. In a node you would have to indeed listen in NodeData.Message() as pointed out by yourself. In a dialog the value would be then attached to the dialog and in case of a node to the node. I.e., in the case of the muscle object thingy polling the quicktab gadget could look like this:
Message(self, node, mid, mdata):
    """Polls a quicktab gadget for the hypothetical muscle object case.

        node (c4d.BaseList2D): The node to which the message has been sent.
        mid (int): The message id.
        mdata (any): The message data. In case of description messages usually
        a `dict` in Python.
    # The conditioning to a specific message/event type is optional, but 
    # should be in your case probably MSG_DESCRIPTION_POSTSETPARAMETER.
        # Unpack from which element the message has been sent.
        eid = mdata["descid"][0].id
        # This has been sent by the quicktab gadget.
        if eid == c4d.ID_CA_MUSCLE_OBJECT_STATE:
            # Get the node state of the parameter which has that quicktab GUI
            # and do different things based on the state.
            state = node[c4d.ID_CA_MUSCLE_OBJECT_STATE]
            if state == c4d.ID_CA_MUSCLE_OBJECT_STATE_RELAX:
                # ...
            elif state ==  c4d.ID_CA_MUSCLE_OBJECT_STATE_COMPRESSED:
                # ...
            # ...
    return True

For a more precise answer you should post code or a more precise description of what you are trying to do. And you should also address the rest of the team since I am still going to be on vacation for a few days.


MAXON SDK Specialist