I searched for this topic on the Internet and in this community and I found no satisfying solutions. I am using a code that was previously posted in this community to make a list of checked checkboxes. The code works as presented but I want to modify it and I do not know how. I have two questions on this topic.
The first is how I might format the list that is created. I was able to add a carriage return (\n) but I was unable to replace ([:} or ("}) with ( ) as shown in the screenshot below. I am pretty certain that I am following the correct nomenclature but I must be placing the request to replace text in the wrong location. The screenshot has only one checkbox selected for clarity.
The second and more pressing question is how I might associate a textbox with every checkbox such that selected checkbox names are displayed along with the contents of the associated text label. You can see in the screenshot that I inserted Temp_ble.Text directly into the machine. This was more of a test of "I wonder what happens if I ..." but obviously I would like to have the textbox contents previously associated with the checkbox such that, when the checkbox is selected, the text label shows up. Thank you so much for any ideas or suggestions.
Well, that was depressing! The last thing I want to do at age 65 while creating an app is to learn another programming language. When I see JSON, I think of the horror movie.
I was hoping I could use a "Join" block and somehow associate every checkbox with a specific label using the MIT Visual block code. It seems like something that many before me have done, as it practically allows one to pull up data based on a check box selection.
I will keep on playing and searching the Internet, as the likelihood of my stumbling across the answer is higher than learning JSON such that I can apply it in this specific situation.
Greetings, Here is my .ala file. I simplified it here so I can better understand the functions. In doing so, I accidentally changed something that no longer allows me to uncheck a checkbox without an error but I am not concerned with that at this point.
One burner question is why I could use the join commands to add a carriage return but when I try to use "Replace All Text" to eliminate the brackets and quotation marks, I can not remove them. Where should these commands be placed to do what I seek?
You can see that I have simply created a Label45 onto which I placed a humidity percentage. You can also see that I placed it in such a way that it shows up attached to every checked box when they are selected. The screenshot shows a previous label (Temp>ble) but the name is immaterial. What I wish to do is to set up this program such that every checkbox has a label "attached" or assigned to it in such a way that when I call up (by checking) any parameters, the program places the label contents after the checkbox text on the selection page. The label contains the result of the necessary calculations.
I am further confused by seeing that people create lists with items and tags, such that calling up a tag displays the item's contents. I want to transfer that logic to checkboxes but my mental acuity is limited to trying to express my desires succinctly here.
The attached .ala allows one to check some boxes and then have their contents displayed on another virtual screen. Unchecking a box creates a false error right now but that is a problem with me duplicating my program for review that doesn't present itself in my full-out file. I will eventually add a "Uncheck All" button as a finishing touch.
I would love to check a number of boxes, then hit "Get Selection" and have the checkbox name appear, followed by the label contents, and a carriage return to the next data point.
As I can sometimes look at an answer and not immediately recognize it for what it is, I would be happy with a link that describes what I am trying to achieve. I am simply overwhelmed by the number of different ways any one objective may be achieved. Thank you, again, for your patience and expertise.
Here's a sample using a YAML display, to avoid the tedium of laying out pairs of Labels and checkboxes.
It works entirely off the text in the CheckBoxes, and off a dictionary fed from procedures to load its data from your favorite data source. I used a test procedure to call a couple such procedures to get some sample data into the dictionary, and from there to the YAML display.
(I left your 35.6% in).
Sample run:
The check box events aren't needed for this approach.
All the work happens in that button click, using two value procedures using the new advanced list blocks.
Wow, I apologize for trying to explain myself. Your comments are a little cheeky for a "Power User" but maybe I caught you at a bad time or you are simply tired of my line of query? Either way, I appreciate the links and your recognition of the obvious - I do NOT know how to work with lists, or a thousand other aspects of AI2.
I am trying hard to learn but my life is not set up for learning by trial and error right now. I learn and move ahead best by studying a functional example of something close to what I am seeking to accomplish. ABG went above and beyond and gave me something to sink my teeth into and play with so no harm, no foul.
OMG! Thank you a thousand times. You must be an educator with your over-the-top clarity and detailed explanation. This is exactly what I have been trying to accomplish (in a most unskillful manner as noted by Talfun;)-. There is so much I do not yet know about AI2 but, in the 2 months that I have been immersed, I have gained skills and confidence thanks to community supporters such as yourself. Words cannot properly express my gratitude.
That incorporated wonderfully into my larger file. My only burning question is where does the data go (how do I make a dictionary)? I tried something like this:
When you posted an .aia you left out the data feed from BLE part.
Otherwise, I could have shown how to call those extra little procedures "save_..." that feed into the global dictionary I included with my sample.
Your global_readings_dictionary is not a dictionary.
A dictionary is a place where you can look things up by name, not by position like a list.
(Look in the Oxford English Dictionary in the reference section of your local library under the word 'Oops'. There's probably a picture of a computer programmer there.)
Greetings,
Fair enough, I make a partial post, I get a partial answer - the best you can do based on what I have provided. In the attached file, I have hidden the five labels for temperature, humidity, and pressure. Perhaps you could demonstrate with the humidity label, as it requires no formula or choice between Imperial or Metric.
Thank you, again, for your guidance.
The check boxes are just a simple and convenient way for someone to select only the data they wish to view. At some point, if I do not go crazy creating the app, I will have a multiplicity of data points available. The check boxes allow a user to customize the data s/he receives - why scan through 20+ data points when you are interested in only five of them.
The concept is that a quantity of check boxes are checked and, when the "fetch" data button is pressed, only the checked boxes appear with the requisite attached data.
I like the layout of multiple check boxes as opposed to a scroll list. It is more a matter of aesthetics. ABG had a novel (to me) solution that I never would have dreamed existed - creating a dictionary with data that is accessed with the associated checkboxes.
You may remember, about 8 weeks ago, I was struggling with UUIDs and thinking I would be using a UUID for every data point. Then, I realized that I can do the calculations in the app and send much less data.
So . . . checking or unchecking simply adds the check box event to the dictionary where I should have matching data available.
That makes sense. Everything else needs specificity (Celsius or Imperial) or a formula. Humidity is about the only copy-and-paste reading and all I need is one example to go to town. And I'm off . . .
Wow, after several days of (mental) anguish trying to associate a checkbox with external content, your example brought tears to my eyes . . . well, for a few seconds;). I now get to be a busy beaver and transcribe some formulas from C++ to Visual math blocks. At least I am back on solid ground in both technique and content. Thank you so much for your time and experience (and solutions)!.
OK, that sense of relief was short-lived. I have examined your blocks and I just do not see where Humidity_ble.Text or fHumidity is handed off to be processed and ultimately wind up as a result of the CheckBox_9_Humidity being checked. How does the humidity measurement find its way into the global_readings_dictionary?
If you could tell me where the magic happens, I would be most grateful.
Start from the BLE.FloatsReceived event block, which I posted above. It has 3 sections, one per reading type. In the humidity section, there is an extra block I inserted, to call my new save_Humidity procedure and pass it the local variable fHumidity through the lazily named parameter x.
I included the save_Humidity procedure, nice and big for easy reading.
It receives a parameter, lazily named x, which should contain the fHumidity value from the call statement earlier. It saves that fHumidity value into the aforementioned global dictionary named readings_dictionary, which is still wired into that Get_Selectrion(sic) button click event, under the key named in the humidity checkbox.
By the way, if you want the numbers in the YAML display to update continuously as data arrives from BLE, you would have to duplicate (via a new procedure) that code from the Get_Selectrion Click event in the BLE data arrival event. Otherwise, the newly arrived data would just sit there in the dictionary.