Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net
 Real-Time Graphics Tools for .Net (VB and C#)
 Iterating through ChartView's attached objects
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

soundar

51 Posts

Posted - 18 Feb 2008 :  15:22:56  Show Profile  Reply with Quote
Is there a way to iterate through all objects that are attached to a ChartView object?

I want to be able to something like this:

For each x as system.object in chartVu.objects(?)
if not Trycast(x,RTScrollframe) is nothing then
dim fr as RTScrollFrame = ctype(x,RTScrollFrame)
fr.Rescaleframe....
end if
next

quinncurtis

1586 Posts

Posted - 18 Feb 2008 :  17:39:16  Show Profile  Reply with Quote
Try and explain why do you want to do what you describe ? We can't image a scenario where this a good approach to getting access to the instance of ScrollFrame.

If you want access to a ScrollFrame that you create for a chart, just make it a variable global to the class. That way you won't have to go looking for it in the ChartView's list of objects. That's the way it is done in the ScrollApplicationUserControl1 example program.
Go to Top of Page

soundar

51 Posts

Posted - 19 Feb 2008 :  13:21:46  Show Profile  Reply with Quote
I am using global arrays right now but I find it cumbersome to use global arrays for everything like process vars, scroll frames, axes, axes labels, colors, line styles etc and was wondering if there is an easier way. If I can iterate through the objects, then I can pass the chartview object itself between functions. This is especially useful if I control chart variables (scaling, color etc) from outside the user control (from the containing form). I have 3 or 4 applications that use the same user control with only slight different parameters.
Go to Top of Page

quinncurtis

1586 Posts

Posted - 19 Feb 2008 :  13:52:31  Show Profile  Reply with Quote
Having to constantly check the type of a an object in order to know what to do with it is not a good OOP programming technique, but that's up to you.

The array of chart objects added to the ChartView can be obtained by calling the ChartView's GetChartObjectsArrayList method. It returns a reference to the internal ArrayList used to store the objects. An ArrayList is .Net System.Collections object.

Dim cvobjarray As ArrayList = Me.GetChartObjectsArrayList()
Dim cvobj As GraphObj
Dim i As Integer

For i = 0 To cvobjarray.Count - 1
  cvobj = cvobjarray(i)
Next i
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07