Data of a Segmentet Object

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Jayare
Posts: 12
Joined: Sat Apr 28, 2012 1:34 pm

Data of a Segmentet Object

Post by Jayare » Sun Jun 21, 2015 1:45 pm

Hello everyone,

i have a simple question, which is driving me crazy. I have created a segmented object (picture is added). Now i need to get the selected segment.

Can anyone give me the line of code, get the selected segment.

Greets
Jochen
Attachments
Bildschirmfoto 2015-06-21 um 14.41.56.png
Bildschirmfoto 2015-06-21 um 14.41.56.png (14.28 KiB) Viewed 4345 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10309
Joined: Wed May 06, 2009 2:28 pm

Re: Data of a Segmentet Object

Post by dunbarx » Sun Jun 21, 2015 2:16 pm

Hi.

When you say "segmented object" do you mean a group of controls? "Segments" is not a native word, so I am interpreting here. That is, are there several images, buttons, fields and graphics that make up the whole?

If so, and I assume so, try this handler in the card script. I am not sure that you made a group at all, ("group" is indeed a LiveCode control) so I am playing it safe and going to the card:

Code: Select all

on mouseUp
put the target
end mouseUp
Does clicking on various portions of your assembly produce the name of a control in the message box? Write back if you need more help.

Craig Newman

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10309
Joined: Wed May 06, 2009 2:28 pm

Re: Data of a Segmentet Object

Post by dunbarx » Sun Jun 21, 2015 2:19 pm

Hi again.

Did you import that whole thing as an image? If so, there will be no way to directly discern what portion of it you are clicking on, since there are no discrete objects making it up. But there is still a way to work around this, by determining the location within the whole where you clicked. This will require a bit of fooling around, but would be a hill of fun.

Write back...

Craig

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Data of a Segmentet Object

Post by Klaus » Sun Jun 21, 2015 2:50 pm

Hallo Jochen,

you are obviously talking about LC 8 and the SEGMENT widget, right?
Please always note the version of LC you are using!

Do this:
...
put the selectedsegment of widget "your segment widget here" into tSelectedSegment
## Will put the NUMBER of the selected segment into the variable
...
BTW: Its all in the dictionary 8)


Best

Klaus

Jayare
Posts: 12
Joined: Sat Apr 28, 2012 1:34 pm

Re: Data of a Segmentet Object

Post by Jayare » Sun Jun 21, 2015 3:06 pm

Hi,

i just took that control out of livecode, the picture is just a screenshot.

I've added a second picture where the control in livened is. My problem is, that i can not name the objekt :(
Attachments
Bildschirmfoto 2015-06-21 um 16.04.16.png

Jayare
Posts: 12
Joined: Sat Apr 28, 2012 1:34 pm

Re: Data of a Segmentet Object

Post by Jayare » Sun Jun 21, 2015 3:09 pm

Hallo Klaus,

thank you for the help! I thought every bond works in livecode 8. Sorry, my fault.

Greets
Jochen


P.S.: Vielen lieben Dank!

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Data of a Segmentet Object

Post by Klaus » Sun Jun 21, 2015 3:13 pm

Hi Jochen,

simply double-click the widget and give it a name in the inspector!
See attached screenshot...


Best

Klaus
Bildschirmfoto 2015-06-21 um 16.12.20.jpg

Post Reply