[Gambas-user] ListView with spaces help

Werner wdahn at ...1000...
Sun Jan 30 09:12:03 CET 2011


On 30/01/11 03:17, Nicolas Koch wrote:
> I have a populated ListView and I want to run commands from the list, but
> the list items with spaces won't work in SHELL or EXEC.
>
> Message.Info(ListView.Current.Text) will return the list item with spaces as
> it should ie. "this is test"
>
> however when I go to
>
> EXEC [ListView.Current.Text]
> or
> SHELL ListView.Current.Text
>
> only "this" will show up in SHELL or EXEC and not "this is test"
>
>
> How do I get ListView.Current.Text to keep the spaces when I EXEC or SHELL?
>
>
>
> code:
>
> PUBLIC SUB Run_Click()
>
>   Message.Info(ListView.Current.Text)
>
>   *' EXEC [ListView.Current.Text]*
>
>   SHELL (ListView.Current.Text)
>
> END
>
>   

If you want to use shell there is Shell$ that does the conversion:
http://gambasdoc.org/help/lang/shell2?v3

If you want to use EXEC you can split a command into its atoms with Split:
http://gambasdoc.org/help/lang/split?v3
using space as separator. It can then be reassembled with brackets and
commas before being used.


Regards,
Werner






More information about the User mailing list