Textbox, Command and Parameters.NextParameter()

Support forum for MegunoLink
Post Reply
leon
Posts: 9
Joined: Tue Nov 12, 2019 2:13 am

Sun Dec 15, 2019 9:42 am

In visualiser I am using Textboxs for the user to enter data. I want to be able to obtain the string values and save them to a csv file.

The way I am trying to achieve this is to;

1. obtain data from textbox in key/value pairs and pass it back to Arduino via Serial Command.
2. obtain the data via Parameters.NextParameter(), parse the data, format, etc in Arduino
3. pass it back to the visualiser via a dedicated Messenger Monitor

For example, I have multiple Textboxs eg Project, Location, Address, etc

I will describe the issue for a single Textbox "Project", where a user could type "XYZ drilling project".

The text is obtained via a command initiated from a Button

The command is as follows !SaveProjectData [IPT_Project.Text]\r\n

The serial monitor displays the following text when the Button is pressed !SaveProjectData XYZ drill project

In the Arduino, the command "SaveProjectData" calls Parameters.NextParameter().
Nothing is subsequently displayed in Message Monitor.

The issue appears to be that Parameters.NextParameter() use a space as delimiter.

The only way to obtain the string data is to cut it back to "XYZ" then it will work ie Steps 1 - 3.

Ideally I would like to able to use a Command and pass all of the Textbox strings eg Project, Location, Address as key/value pairs

eg !SaveProjectData [IPT_Project.Name]=[IPT_Project.Text]|[IPT_Location.Name]=[IPT_Location.Text]|[IPT_Address.Name]=[IPT_Address.Text]\r\n

I think a solution could be to have a user defined delimiter eg "|" so that key/value pairs can be obtained.

I have searched the forum and cant find a solution.

Suggestions/ideas would be appreciated.
Cheers
Leon
Attachments
MegunoLink-Textbox.JPG
MegunoLink-Textbox.JPG (13.79 KiB) Viewed 6176 times
philr
Posts: 446
Joined: Mon May 26, 2014 10:58 am

Sat Jan 04, 2020 6:51 am

Hi Leon, I think you can go Parameters.RemainingParameters() to get all the remaining characters which shouldn't break them up.
Post Reply