Re-Ordering Items in a TYPE...

Blitz3D Forums/Blitz3D Programming/Re-Ordering Items in a TYPE...

hollifd(Posted March) [#1]
Is there an easy way to re-order things I have stored in a TYPE? I need to be able to change or re-order the SEQ% in the following TYPE.



  Type BendData
		Field SEQ%		;Bend sequence number
		Field Entity	;Mesh
		Field Name$		;Mesh name
		Field XL#		;XLeft
		Field XR#		;XRight
		Field LGA#		;Left gage allowance
		Field RGA#		;Right gage allowance
		Field FO#		;Finger offset
		Field ZL#		;ZLeft
		Field ZR#		;ZRight
		Field RL#		;RLeft
		Field RR#		;RRight
		Field Angle#	;Angle of bend
		Field BL#		;Bend length
		Field Tonnage#	;Tonnage
		Field PartX#	;PartX
		Field PartY#	;PartY
		Field PartZ#	;PartZ
		Field PartPitch#;PartPitch
		Field PartYaw#	;Partyaw
		Field PartRoll# ;PartRoll
  End Type

	For b.BendData = Each BendData
		;code to reorder seq% goes here...
	Next



You don't have to write the code for me. I am just looking to know the recommended way it is done. High level process...pseudocode.?

Thanks,
David


Zethrax(Posted March) [#2]
The Insert command is used to relink objects within a typelist. You can find examples of its useage at the link below.

http://www.blitzbasic.com/b3ddocs/command.php?name=Insert&ref=goto

Also take a look at the Before, After, First, Last commands for parsing a typelist.


hollifd(Posted March) [#3]
Got it. I'll give this a try.
Thanks for the link.
David


Floyd(Posted March) [#4]
I have a couple of Code Archive entries which do this. In one month they will be sixteen years old. Hard to believe.

http://www.blitzbasic.com/codearcs/usercode.php?user=21


hollifd(Posted March) [#5]
Sweet! Thanks Floyd.


TomToad(Posted March) [#6]
@Floyd, your math is a bit off. 2002 was fifteen years ago. You're not quite as old as you think. :)


Floyd(Posted March) [#7]
The math is okay but my memory betrayed me.

I saw the date but then got distracted after running the code. It flashed briefly on screen and disappeared, so I had to add WaitKey. I must have originally run with debug on.

I think the code really is from 2001 when I started with Blitz Basic. What I remember about that is the demo seemed too good, not enough incentive to buy real thing.