Issue 33807 - For Each syntax to basic
Summary: For Each syntax to basic
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: scripting (show other issues)
Version: 680m50
Hardware: All All
: P3 Trivial (vote)
Target Milestone: AOO Later
Assignee: ab
QA Contact: issues@framework
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-03 13:52 UTC by luiz_augusto
Modified: 2005-09-21 10:06 UTC (History)
2 users (show)

See Also:
Issue Type: FEATURE
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Patch that add 'For Each' syntax to basic (14.75 KB, patch)
2004-09-03 14:07 UTC, luiz_augusto
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description luiz_augusto 2004-09-03 13:52:52 UTC
Add syntax 'For Each' to OO.o Basic:
 - Supports Arrays or Uno object that has the interface
com.sun.star.container.XEnumeration.
Comment 1 luiz_augusto 2004-09-03 14:07:25 UTC
Created attachment 17535 [details]
Patch that add 'For Each' syntax to basic
Comment 2 noel.power 2004-09-03 14:15:34 UTC
patch for "foreach" for you Andreas
Comment 3 ab 2004-10-04 10:08:02 UTC
I first want to have a deeper look on the complete Collection subject that probably
will be addressed in general before added new language features related to this.
-> OOo later
Comment 4 luiz_augusto 2005-02-09 17:50:47 UTC
It seens that someone applied a very modified patch for this issue in m76, but i
couldn't find the branch in eis. Can someone tell me the status?
Comment 5 ab 2005-03-07 10:14:06 UTC
I've added "For each" in the scope of implementing the Collection object support.
The original patch could not be used, because it did not support the Collection
object of course. Besides that I was not completely happy with some code in this
patch, e.g. the unnecessarily complex type conversion in nextElement() and the 
usage of XEnumeration (the object has to support XEnumerationAccess instead). 
But nevertheless, thanks for the effort and now "for...each" is supported by OOo 
Basic anyway. -> Resolved
Comment 6 luiz_augusto 2005-03-29 12:39:41 UTC
I got a minor problem, in the code:

Sub Main
	Dim vet(3)
	Dim var as boolean
	vet(1) = 1
	vet(2) = 2
	vet(3) = 3
	for each var in vet
		MsgBox var
	next
End Sub

This code is invalid, because loop control variable must be variant type. Also 
the index of array begins in 0 and end in 3, so actually the array size is 
interpreted as 4 instead of 3.
Comment 7 ab 2005-04-05 16:57:21 UTC
In general I don't consider it as a severe problem if code runs that does
not run in VB. Concerning the array size: It really is 4, the valid indices
are 0, 1, 2, 3. That's just how the array is specified.

-> Closed, if there are still problems please submit another issue
Comment 8 bmarcelly 2005-09-21 10:06:59 UTC
Target milestone is currently OOo Later
However it is already available in 1.9.130 (probably also in older releases). Should 
the Target milestone be changed ?

Please remember designers that without an updated documentation their work may never be 
used.
I would like to see the on-line Help updated with examples. I could not find how to 
make it work on an enumeration.