Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hello, When I create a GeDialog with buttons, the first button is highlighted by default for some reason:
import c4d from c4d import gui MY_PLUGIN_ID = 1234567 GROUP1_ID = 1000 GROUP2_ID = 1001 BUTTON1_ID = 1002 BUTTON2_ID = 1003 BUTTON3_ID = 1004 class Example_Dialog(gui.GeDialog): def CreateLayout(self): self.SetTitle("BUTTON_HIGHLIGHTED") self.GroupBorderSpace(10,10,10,10) if self.GroupBegin(GROUP1_ID, c4d.BFH_SCALEFIT | c4d.BFV_SCALE | c4d.BFV_CENTER): if self.GroupBegin(GROUP2_ID, c4d.BFH_SCALEFIT, 1): self.GroupBorderSpace(5,5,5,5) self.AddButton(BUTTON1_ID, c4d.BFH_SCALEFIT | c4d.BFV_SCALE | c4d.BFV_CENTER, name='Button1') self.AddButton(BUTTON2_ID, c4d.BFH_SCALEFIT | c4d.BFV_SCALE | c4d.BFV_CENTER, name='Button2') self.AddButton(BUTTON3_ID, c4d.BFH_SCALEFIT | c4d.BFV_SCALE | c4d.BFV_CENTER, name='Button3') self.GroupEnd() self.GroupEnd() return True # Main function def main(): global example_dialog example_dialog = Example_Dialog() example_dialog.Open(c4d.DLG_TYPE_ASYNC, pluginid=MY_PLUGIN_ID, defaultw=300, defaulth=150) # Execute main() if __name__=='__main__': main()
Hello @blastframe,
thank you for reaching out to us. This is the correct behavior of GeDialog. It will always set the focus to its first element, so that users can navigate the dialog with the keyboard. If you look at our asset API examples dialog from the C++ SDK, it has the same behavior:
GeDialog
There are technically two ways to suppress this behavior.
BFM_SETFOCUS
I would say setting the focus to a dummy element is bad because it will break the keyboard input mechanics put into place by Cinema 4D. And I also have not tested what the side-effects of such hack would be. Or to be a bit more direct: This is simply not something you are intended to do. You can always set the focus of gadgets with GeDialog.Activate, but this does not allow you to clear the focus or set it to illegal elements.
GeDialog.Activate
Cheers, Ferdinand
Hello @blastframe ,
we will set this topic to 'Solved' when there are no further questions or replies until Monday, November the 22th.
Thank you for your understanding, Ferdinand