Page 1 of 1

Data of a Segmentet Object

Posted: Sun Jun 21, 2015 1:45 pm
by Jayare
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

Re: Data of a Segmentet Object

Posted: Sun Jun 21, 2015 2:16 pm
by dunbarx
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

Re: Data of a Segmentet Object

Posted: Sun Jun 21, 2015 2:19 pm
by dunbarx
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

Re: Data of a Segmentet Object

Posted: Sun Jun 21, 2015 2:50 pm
by Klaus
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

Re: Data of a Segmentet Object

Posted: Sun Jun 21, 2015 3:06 pm
by Jayare
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 :(

Re: Data of a Segmentet Object

Posted: Sun Jun 21, 2015 3:09 pm
by Jayare
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!

Re: Data of a Segmentet Object

Posted: Sun Jun 21, 2015 3:13 pm
by Klaus
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