Page 1 of 1

Segmented widget inside a DG form

Posted: Sat Apr 11, 2020 9:41 am
by trevix
I thought it was convenient to place a segmented widget inside my DG form template, instead of building from scratch a similar thing (it is used to chose between only two values).
But I am having problem on transfering the user choice out of the DG.

I am using this code in the DG script

Code: Select all

on hiliteChanged
     put the short name of the target into tTarget
     put GetDataOfLine(the dgHilitedLines of me, "UUID") into tUUID
     if tTarget = "BTcolor" then --value of BTcolor widget can be 1 or 2
          put the hilitedItems of the target into tValue --1= black  2 = white
          if tValue is not empty then
               setDataOfLine the dgLine of me, "BTcolor", the hilitedItems of the target
               F_ButtonSet tUUID, "color", tValue --this is my command in the main stack
          end if
     end if
end hiliteChanged
Problem is that the DG line doesn't get selected when clicking on the widget, so the obtained data are wrong (UUID and tValue).
Is there something that I am missing?

It will be used in desktop and mobile. I am using LC 9.6.0
Thanks

Re: Segmented widget inside a DG form SOLVED

Posted: Sat Apr 11, 2020 9:51 am
by trevix
Sorry, my mistake.
This works:

Code: Select all

on hiliteChanged
     put the short name of the target into tTarget
     put the dgline of me into tLine
     put GetDataOfLine(the dgline of me, "UUID") into tUUID
     if tTarget = "BTcolor" then
          put the hilitedItems of the target into tValue --1= black  2 = white
          if tValue is not empty then
               setDataOfLine the dgLine of me, "BTcolor", the hilitedItems of the target
               F_ButtonSet tUUID, "color", tValue
          end if
     end if
end hiliteChanged