cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How make to multi check select box

jjeon
3-Newcomer

How make to multi check select box

Hi, i ask something.

How make to multi check select box.

checked Item value into input box.

qa2.PNG

ACCEPTED SOLUTION

Accepted Solutions
hheinz
7-Bedrock
(To:jjeon)

  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.

View solution in original post

2 REPLIES 2
hheinz
7-Bedrock
(To:jjeon)

  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.

jjeon
3-Newcomer
(To:jjeon)

Thank you.

i 'll try it.

Announcements


Top Tags