It is currently Wed May 22, 2013 8:41 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: 4.61 b1 - Macro error
PostPosted: Sun Feb 19, 2012 3:48 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Feb 28, 2007 9:13 am
Posts: 923
Location: Edinburgh
Running the following code on Windows XP and 7, I get a compiler error on the line where the macro StringifyGroupParameter is used.

Code:
Structure TestStructure
   Map parameter.b()
EndStructure
Global NewMap Group.TestStructure()

Macro StringifyGroupParameter(type)
   key.s = Str(type)
   If FindMapElement(\parameter(),key)
      Debug "ok"
   EndIf
EndMacro

Procedure.s Test(ocode.s)
   
   With Group(ocode)
      
      Dim paramt.s(1)
      StringifyGroupParameter(0)
      
   EndWith
   
EndProcedure

_________________
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."


Top
 Profile  
 
 Post subject: Re: 4.61 b1 - Macro error
PostPosted: Sun Feb 19, 2012 5:20 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 10, 2008 1:30 pm
Posts: 711
Location: Germany, Glienicke
With isn't work in the inserted macro!

_________________
Image


Top
 Profile  
 
 Post subject: Re: 4.61 b1 - Macro error
PostPosted: Sun Feb 19, 2012 5:27 pm 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1565
Location: Germany
Unfortunately the With / EndWidth keyword doesn't work inside Macros.

Edit: STARGÅTE already said it.


Top
 Profile  
 
 Post subject: Re: 4.61 b1 - Macro error
PostPosted: Sun Feb 19, 2012 6:02 pm 
Offline
Enthusiast
Enthusiast

Joined: Sun Apr 06, 2008 12:54 pm
Posts: 218
Location: Brisbane, Qld, Australia
I encountered a similar problem recently regarding Macros and With, so I now pass the group instance as a parameter to the macro, eg:

Code:
Structure TestStructure
   Map parameter.b()
EndStructure
Global NewMap Group.TestStructure()

Macro StringifyGroupParameter(type, pGroup)
   key.s = Str(type)
   If FindMapElement(pGroup\parameter(),key)
      Debug "ok"
   EndIf
EndMacro

Procedure.s Test(ocode.s)
   
   Dim paramt.s(1)
   StringifyGroupParameter(0, Group(ocode))
     
EndProcedure

You can still use With inside Test if you need it for other reasons - it's just that the Macro cannot use it and macros also cannot contain With.

_________________
Mike


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: davido and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye