Segmented widget inside a DG form

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
trevix
Posts: 1077
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Segmented widget inside a DG form

Post by trevix » Sat Apr 11, 2020 9:41 am

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
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

trevix
Posts: 1077
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Re: Segmented widget inside a DG form SOLVED

Post by trevix » Sat Apr 11, 2020 9:51 am

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
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>

Post Reply