Skip to main content
4-Participant
November 20, 2015
Solved

How make to multi check select box

  • November 20, 2015
  • 2 replies
  • 2306 views

Hi, i ask something.

How make to multi check select box.

checked Item value into input box.

qa2.PNG

Best answer by hheinz
  1. Use a Table element with a single column. Remember to fully initialize the Table before you display it. Also remember to put any custom images you want into preload elements (just declare them in the res-file.)
  2. Declare a bool array (or plain int array) that contains the "checked" state for each button. Make it static. Remember to initialize it.
  3. To the Table element you can programmatically add Checkbuttons via ProUITableCheckbuttonAdd(). Use a component name that contains the item number.
  4. Use ProUICheckbuttonActivateActionSet() to set an action for each Button. Give the item number as the "data" component (remember to cast it to ProAppData - pass the number, NOT a pointer to the number!). You can use the same action for each button - with differing inputs, of course.
  5. In that action, manipulate the appropriate entry in your state array (remember to correct for offset - Item 1 to array[0] and so on)
  6. Benefit!
  7. If you want you can also trigger a function that updates a label (or something else) that shows which items have been selected.

2 replies

hheinz1-VisitorAnswer
1-Visitor
November 20, 2015
  1. Use a Table element with a single column. Remember to fully initialize the Table before you display it. Also remember to put any custom images you want into preload elements (just declare them in the res-file.)
  2. Declare a bool array (or plain int array) that contains the "checked" state for each button. Make it static. Remember to initialize it.
  3. To the Table element you can programmatically add Checkbuttons via ProUITableCheckbuttonAdd(). Use a component name that contains the item number.
  4. Use ProUICheckbuttonActivateActionSet() to set an action for each Button. Give the item number as the "data" component (remember to cast it to ProAppData - pass the number, NOT a pointer to the number!). You can use the same action for each button - with differing inputs, of course.
  5. In that action, manipulate the appropriate entry in your state array (remember to correct for offset - Item 1 to array[0] and so on)
  6. Benefit!
  7. If you want you can also trigger a function that updates a label (or something else) that shows which items have been selected.

jjeon4-ParticipantAuthor
4-Participant
December 1, 2015

Thank you.

i 'll try it.