132 views
in GUI Development by

Hi,

I'm adding a menu item programmatically to an outline. The menu item has a combo box and I have a method to load the combo box items as well like the one following.

 var Menus::GUI_MenuItem_Common MeasureMode = new Menus::GUI_MenuItem_Common;
   MeasureMode.CaptionText.String ="Measuremode";
   MeasureMode.NoOfItems =4;
   OnloadMode(MeasureMode);
   Add( MeasureMode, 0 );

Here is the OnloadMode() implementation.

 

How ever I'm getting an error message as follows.

[2.10.2025 14:42:50] Runtime Menus::pH_SettingTest.OnloadMode (1:35) : 'Item' in scope of a 'null' object.
[2.10.2025 14:42:50] Runtime Core::Group.Add (2:3) : Chora exception: 'No view to add'.

Could you please assist me in achieving this task?

Best Regards,

Thanushiyah

1 Answer

0 votes
by

Hello Thanushiyah,

If you are using the Combo Box templates, the variable View is valid only during the execution of the OnLoadItem method associated to the Combo Box. Outside this context the variable is null.

I suppose, with the initialization code you want to select which item the Combo Box should show. If this is the case, use the property SelectedItem to identify which item in the Box should be shown.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...