Using a #define value in a vslider definition

Posted By: miko93

Using a #define value in a vslider definition - 05/24/08 15:19

Hello all.

I'm trying to use a "#define XX" value in my vslider definition, but somehow this won't work. Please take a look at this code here:

Code:
#include <acknex.h>
#include <default.c>
#include <stdio.h>
#include <windows.h>

#define MYRANGE 50

BMAP* bmSlider = "slider.bmp";
var   SliderPosition = 1;

PANEL* pPanel1 = // This works ok.
{
	flags =  VISIBLE; 
	vslider = 494, 2, 125, bmSlider, 1, 50, SliderPosition;
}

PANEL* pPanel2 = // This gives a syntax error, pointing to MYRANGE.
{
	flags =  VISIBLE; 
	vslider = 494, 2, 125, bmSlider, 1, MYRANGE, SliderPosition;
}


function main(void)
{
	video_mode = 8; // 1024x768
	fps_max = 60;
		
	level_load("");
	wait(3);
	
	while (1)
	{
    	wait (1);
	}
}


The problem is that as soon as I try to use the #define'd value in my definition of vslider (2nd panel), the compiler gives out a "number syntax" error.

Any hints why this is not working? Thanks a lot.
Posted By: Christian__A

Re: Using a #define value in a vslider definition - 05/24/08 15:22

Maybe the compiler does simply not allow macros in panel definitions?
Posted By: miko93

Re: Using a #define value in a vslider definition - 05/25/08 08:15

Christian, thanks, yes. After some more tests, this is the most obvious reason, I think.
Although not being a real problem, it is some sort of "inconsistency", as preprocessor constants should be available everywhere in the code (at least, imho).

Maybe, I should point this out at the bughunt forum...
© 2024 lite-C Forums