Grouping question

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Grouping question

Peter Haworth
I want to use the import command in a script to import an image from a file
of the user's choice.  The catch is that I want the resulting image to end
up in a group and, unlike the create command, the import command doesn't
have a way to specify a group.

In the past when I've run into this, I get the ids of the group's controls,
ungroup the group, add the id of the new image to the list of group
controls, then group them, or copy the control into the group and delete
the original control.

Both those methods seem somewhat clumsy so I'm wondering if there's a more
elegant way to do this.

Pete
lcSQL Software <http://www.lcsql.com>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Grouping question

Monte Goulding

On 22/03/2013, at 7:52 AM, Peter Haworth <[hidden email]> wrote:

> Both those methods seem somewhat clumsy so I'm wondering if there's a more
> elegant way to do this.

Hmm.. setting the relayerGroupedControls to true and setting the layer of the image to somewhere inside the group is an option... I'm not sure if that's elegant either but it's an option

--
Monte Goulding

M E R Goulding - software development services
mergExt - There's an external for that!





_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Grouping question

Marty Knapp-2
In reply to this post by Peter Haworth
Hey Pete,
Why not create an image in the group you want, then use the "put URL"
method:

create image in group "GroupName" of stack "StackName"
put it into tImageID --long id of image
put URL (binfile:" & tPathToImage) into image tImageID of group
"GroupName" of stack "StackName"


Marty Knapp

> I want to use the import command in a script to import an image from a file
> of the user's choice.  The catch is that I want the resulting image to end
> up in a group and, unlike the create command, the import command doesn't
> have a way to specify a group.
>
> In the past when I've run into this, I get the ids of the group's controls,
> ungroup the group, add the id of the new image to the list of group
> controls, then group them, or copy the control into the group and delete
> the original control.
>
> Both those methods seem somewhat clumsy so I'm wondering if there's a more
> elegant way to do this.
>
> Pete
> lcSQL Software <http://www.lcsql.com>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Grouping question

Peter Haworth
In reply to this post by Peter Haworth
Well I guess neither of the methods I mentioned will work since the import
command does not give me the id of the image it creates, at least not in
the it variable or the result.

So I guess I'm back to using the create command which solves the issue of
getting the image into the correct place, along with setting the filename
of the image after I create it.  But that ends with with a referenced
control, which I don't want.

I hope I'm missing something obvious.....

Pete
lcSQL Software <http://www.lcsql.com>


On Thu, Mar 21, 2013 at 1:52 PM, Peter Haworth <[hidden email]> wrote:

> I want to use the import command in a script to import an image from a
> file of the user's choice.  The catch is that I want the resulting image to
> end up in a group and, unlike the create command, the import command
> doesn't have a way to specify a group.
>
> In the past when I've run into this, I get the ids of the group's
> controls, ungroup the group, add the id of the new image to the list of
> group controls, then group them, or copy the control into the group and
> delete the original control.
>
> Both those methods seem somewhat clumsy so I'm wondering if there's a more
> elegant way to do this.
>
> Pete
> lcSQL Software <http://www.lcsql.com>
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Grouping question

Klaus on-rev
Hi Pete,

Am 21.03.2013 um 22:03 schrieb Peter Haworth <[hidden email]>:

> Well I guess neither of the methods I mentioned will work since the import
> command does not give me the id of the image it creates, at least not in
> the it variable or the result.
>
> So I guess I'm back to using the create command which solves the issue of
> getting the image into the correct place, along with setting the filename
> of the image after I create it.  But that ends with with a referenced
> control, which I don't want.
>
> I hope I'm missing something obvious.....

yep, the last posting of Marty Knapp :-D

> Pete
> lcSQL Software <http://www.lcsql.com>

Best

Klaus

--
Klaus Major
http://www.major-k.de
[hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Grouping question

Monte Goulding
In reply to this post by Peter Haworth

On 22/03/2013, at 8:03 AM, Peter Haworth <[hidden email]> wrote:

> Well I guess neither of the methods I mentioned will work since the import
> command does not give me the id of the image it creates, at least not in
> the it variable or the result.

get the long id of the last image
>
> So I guess I'm back to using the create command which solves the issue of
> getting the image into the correct place, along with setting the filename
> of the image after I create it.  But that ends with with a referenced
> control, which I don't want.

See Marty's solution which will set the text of the image to the contents of the file.

--
Monte Goulding

M E R Goulding - software development services
mergExt - There's an external for that!





_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Grouping question

Peter Haworth
In reply to this post by Marty Knapp-2
Perfect,thanks Marty.
Pete
lcSQL Software <http://www.lcsql.com>


On Thu, Mar 21, 2013 at 2:01 PM, Marty Knapp <[hidden email]>wrote:

> Hey Pete,
> Why not create an image in the group you want, then use the "put URL"
> method:
>
> create image in group "GroupName" of stack "StackName"
> put it into tImageID --long id of image
> put URL (binfile:" & tPathToImage) into image tImageID of group
> "GroupName" of stack "StackName"
>
>
> Marty Knapp
>
>> I want to use the import command in a script to import an image from a
>> file
>> of the user's choice.  The catch is that I want the resulting image to end
>> up in a group and, unlike the create command, the import command doesn't
>> have a way to specify a group.
>>
>> In the past when I've run into this, I get the ids of the group's
>> controls,
>> ungroup the group, add the id of the new image to the list of group
>> controls, then group them, or copy the control into the group and delete
>> the original control.
>>
>> Both those methods seem somewhat clumsy so I'm wondering if there's a more
>> elegant way to do this.
>>
>> Pete
>> lcSQL Software <http://www.lcsql.com>
>>
>> ______________________________**_________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode>
>>
>
>
>
> ______________________________**_________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode>
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode