Using Structures In Procedures

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by SoulTaker.

Hi,

Ok big problem for me need some help on this. I'm converting my Visual Basic Custom API Drawing Procedures to PureBasic for all.

Problem:

Procedure A()

B(BackColor.l)

EndProcedure

Procedure B(Color.l)

heres the problem, i need to access 2 Structure here in B

VB Code:

Dim Brush As LOGBRUSH (Structure)
Dim lpRect As RECT (Structure)

EndProcedure

How do I get access to these 2 Structures?

I know that i can pass a pointer to the structures.
*lpRect.RECT and *Brush.LOGBRUSH

But i only need to use them in Procedure B not A.

Procedure A calls Procedure B.

Any help on this would be appreciated.

Thank you.


Abit BD7-II Raid P4 1.9 gHz 384 Ram Xtasy GFroce 3 TI 200 CD-RW DirectX 9.0 Beta 2 Sound Blaster Live! XP Pro, Registered PureBasic version 3.30 For Windows.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

Code: Select all

Procedure B(Color.l)  Brush.LOGBRUSH
  lpRect.RECT
EndProcedure

Procedure A()
  B(BackColor.l)
EndProcedure
cya,
...Danilo


(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.

maybe this will help

Code: Select all

Global lpRect.RECT 
Global Brush.LOGBRUSH

lpRect\left=10

Procedure B(Color.l)
 Debug lpRect\left
EndProcedure

Procedure A()

  B(BackColor.l)

EndProcedure

a()
Regards,

Berikco

http://www.benny.zeb.be
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.
Originally posted by SoulTakerBut i only need to use them in Procedure B not A.
Uups, dit not read whole question...Dilo was quicker, and better solution :)

Regards,

Berikco

http://www.benny.zeb.be
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

L.O.L. @ Bekco

cya,
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by SoulTaker.

Thank yo Guys.

When i get this all converted and running, it will allow you to write your own controls say like a database grid what ever you can think up.

And Danilo i did download your ToolBar Pro nice job.


Abit BD7-II Raid P4 1.9 gHz 384 Ram Xtasy GFroce 3 TI 200 CD-RW DirectX 9.0 Beta 2 Sound Blaster Live! XP Pro, Registered PureBasic version 3.30 For Windows.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by waffle.

while on the subject of structures....
how do i create a linked list of structures thats global ?
is it
structure APlayer
Name.s
UID.l
endstructure
global newlist Player.Aplayer()
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

I think lists are always global?

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

It's just NewList Player.Aplayer().

Linked Lists and Arrays are always Global, no matter, where you define them.
(Inside or ouside of Procedures)

Timo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by waffle.

thanks.

i thought it was something simple like that :)
Post Reply