218 views
in GUI Development by
Hey,

1. I've never used the Combobox example before. I have a little difficulty adjusting the template. What is the easiest way to implement fetching the length of the list from property / variable and fetching the content of the list (string) from the array.

2. I am writing a program that communicates via bluetooth using a virtual serial port. In order not to generate unnecessary delays, I would like to connect to the device once and disconnect if necessary. Is there a way to run a continuous operation of the native function in the background while the application is running?
Best regards,

Kyo.

1 Answer

+1 vote
by
 
Best answer

Hello Kyo,

concerning your first question, if I understood it correctly, you want to know how to setup the number of items (the length) of the list in the combo box and how to load the items from an array. The first aspect is controlled by the property NoOfItems. You can setup this property directly in Inspector window if the number of items are fixed or programmatically when you initialize the GUI component containing the Combo Box as shown below:

ComboBox.NoOfItems = 1234;

The Combo Box items are loaded automatically by the Combo Box. All you have to do is to implement an OnLoadItem method. How this is done is demonstrated in the Example component belonging to the Combo Box template. In this example we load the items with some static strings by using a switch/case statement to determine the right string. If the strings are found in an array then following could be the implementation of the OnLoadItem method:

ComboBox.View.String = SomeArray[ ComboBox.View.Item ];

Concerning your second question, it is difficult to give to right advise. If you are using an operating system you can run the operation in a separate background thread. Doing this, however, be aware of the restriction that Embedded Wizard code may not be called from a thread other than the GUI thread. You will this need to implement communication between the background (worker) and the GUI thread. Concerning the multi-thread restrictions please see: Avoid multithreading.

With Embedded Wizard itself you could use a timer and so 'simulate' the continues operation. For example, you can configure the timer to expire 10 times per second. This should be fast enough to detect the connection/disconnection, I think. Concerning the usage of timers please see: Using timers and animation effects: Timer.

I hope it helps you further.

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

...