2 registered members (AndrewAMD, 1 invisible),
1,086
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Invalid Aguments
#412730
12/02/12 05:00
12/02/12 05:00
|
Joined: Nov 2011
Posts: 139 India
Yashas
OP
Member
|
OP
Member
Joined: Nov 2011
Posts: 139
India
|
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);
}
}
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..
|
|
|
Re: Invalid Aguments
[Re: Yashas]
#412734
12/02/12 05:24
12/02/12 05:24
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
//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
|
|
|
|