Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 1,086 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Invalid Aguments #412730
12/02/12 05:00
12/02/12 05:00
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Code:
FONT * DialogBoxTitleFont = "Arial#20b";
	FONT * DialogBoxTextFont = "Arial#15b";
	FONT * DialogBoxNoteFont = "Arial#14b";
	void HideDialogBox (DialogBox * dlgbx)
	{
		while(dlgbx->Container.alpha > 0)
		{
			dlgbx->Container.alpha -= 2;
			wait(0.01);
		}	
		reset(dlgbx->Container,SHOW);	
	}
	DialogBox * CreateDialogBox(STRING * Title,STRING * Note,STRING * Text,int alpha)
	{
		DialogBox * dlgbx = sys_malloc(sizeof(DialogBox));
		dlgbx->Title = Title;
		dlgbx->Note = Note;
		dlgbx->Text = Text;
		dlgbx->alpha = alpha;
		dlgbx->Container = pan_create("bmap = DialogBox; ",100);
		pan_setstring(dlgbx->Container,0,5,5,DialogBoxTitleFont,dlgbx->Title);
		pan_setstring(dlgbx->Container,0,5,5,DialogBoxTextFont,dlgbx->Text);
		pan_setstring(dlgbx->Container,0,5,5,DialogBoxNoteFont,dlgbx->Note);
		
		pan_setbutton(dlgbx,0,0,20,200,ButtonNormal,ButtonHover,ButtonClicked,NULL,NULL,NULL,NULL);
		pan_setbutton(dlgbx,0,0,220,200,ButtonNormal,ButtonHover,ButtonClicked,NULL,NULL,NULL,NULL);
	}
	void SetDialogBoxEvents (DialogBox * dlgbx,void * OK,void * Cancel)
	{
		pan_setbutton(dlgbx,1,0,20,200,ButtonNormal,ButtonHover,ButtonClicked,NULL,OK,NULL,NULL);	
		pan_setbutton(dlgbx,2,0,220,200,ButtonNormal,ButtonHover,ButtonClicked,NULL,Cancel,NULL,NULL);	
	}
	void ShowDialogBox(DialogBox * dlgbx)
	{
		dlgbx->Container.alpha = 0;
		set(dlgbx->Container,SHOW);
		while(dlgbx->Container.alpha < dlgbx->alpha)
		{
			dlgbx->Container.alpha += 2;
			wait(0.01);
		}
	}



Code:
DialogBox * DeleteProfileDialogBox;
void ConformDeleteProfile ()
{
	STRING * ProfileFile = str_cat(str_cat(str_create("Accounts\\"),(ActiveProfile.Name)),".ini");
	HideDialogBox(DeleteProfileDialogBox);
}
void CancelDeleteProfile ()
{
	HideDialogBox(DeleteProfileDialogBox);	
}
void DeleteProfile ()
{
	DeleteProfileDialogBox =	CreateDialogBox("Conform Delete","*Not a reversible action","Are you sure you want to delte this account??",60);
	SetDialogBoxEvents(DeleteProfileDialogBox,ConformDeleteProfile,CancelDeleteProfile);	
}



Invalid Arguments in CreateDialogBox and SetEvents too..


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: Invalid Aguments [Re: Yashas] #412734
12/02/12 05:24
12/02/12 05:24
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
Code:
//your specifying this function returns a type of dialogbox* but you do not return anything in it??
DialogBox * CreateDialogBox(STRING * Title,STRING * Note,STRING * Text,int alpha)
{
	DialogBox * dlgbx = sys_malloc(sizeof(DialogBox));
	if(dlgbx)//is dlgbx valid ??
	{
		dlgbx->Title = Title;
		dlgbx->Note = Note;
		dlgbx->Text = Text;
		dlgbx->alpha = alpha;
		dlgbx->Container = pan_create("bmap = DialogBox; ",100);
		pan_setstring(dlgbx->Container,0,5,5,DialogBoxTitleFont,dlgbx->Title);
		pan_setstring(dlgbx->Container,0,5,5,DialogBoxTextFont,dlgbx->Text);
		pan_setstring(dlgbx->Container,0,5,5,DialogBoxNoteFont,dlgbx->Note);
	
		pan_setbutton(dlgbx,0,0,20,200,ButtonNormal,ButtonHover,ButtonClicked,NULL,NULL,NULL,NULL);
		pan_setbutton(dlgbx,0,0,220,200,ButtonNormal,ButtonHover,ButtonClicked,NULL,NULL,NULL,NULL);

		//return dlgbx
		return dlgbx;
	}
	//oops no valid dlgbx
	return NULL;
}

//in you other function note the return value before using 
DialogBox *DeleteProfileDialogBox =CreateDialogBox(bla bla);

if(DeleteProfileDialogBox!=NULL)//is it valid??
{
	//valid!! use it
}
else display error



also im not sure if your malloc works correct but i always use it like this

my_object *object=(my_object*)malloc(sizeof(my_object));


Compulsive compiler
Re: Invalid Aguments [Re: Wjbender] #412738
12/02/12 07:20
12/02/12 07:20
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
^^OMG LOL
Forgot abt RETURN grin grin


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1