Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass Structures

Status
Not open for further replies.

girls3dog1

Programmer
Nov 22, 2002
30
US
Can Structure objects only be passed window to window via openwithparm and then extract data contained within with the Message object? Can I simply declare and create an instance of the structure in another window and then proceed to extract data from it without using the Message object?
 
Hi,

You are better off creating a non-visual to mimic the structure i.e. using public instance variables. You can then pass the non-visual as an argument in message.powerobjectparm and cast into another variable of the same type as the non-visual:
Code:
n_cst_example lnv_example

lnv_example.is_examplestring = "Hello"
lnv_example.il_examplelong = 42

OpenWithParm(w_r_response, lnv_example)

then in the open event (or pfc_preopen event) of w_r_response

Code:
n_cst_example lnv_receivingvariable // note: same type

lnv_receivingvariable = message.powerobjectparm

MessageBox("Example String", lnv_receivingvariable.is_examplestring)

MessageBox("Example Long", String(lnv_receivingvariable.is_examplelong))

One of the advantages of using a non-visual as your structure is that you are able to take advantage of inheritance.

Cheers.
 
Oops, that should read

Code:
MessageBox("Example Long", String(lnv_receivingvariable.il_examplelong))

Cheers.
 
If diffrent windows need to pass datas,they must use message or other global objects/variables.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top