237 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 - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...