THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/02/2003 at 17:37, xxxxxxxx wrote:
Oh yeah! :) Here's the code:
Bool ErrorDialog::CreateLayout()
{
Bool cancel = FALSE;
BitmapButtonCustomGui* erroricon;
StatusSetText(GeLoadString(ERROR_STATUS_TEXT));
SetTitle(GeLoadString(ERROR_DIALOG_TITLE));
GroupBegin(5000, BFH_CENTER, 2, 2, NULL, 0);
{
// some room for the icon
GroupBorderSpace( 8, 8, 8, 8 );
{
BaseContainer settings;
settings.SetBool(BITMAPBUTTON_BUTTON,TRUE);
erroricon = (BitmapButtonCustomGui* )AddCustomGui(4000,CUSTOMGUI_BITMAPBUTTON,String(),BFH_FIT,0,0,settings);
}
if (erroricon) erroricon->SetImage(GeGetPluginPath() + Filename("res") + Filename("erroricon.tif"));
GroupBegin(5001, BFH_CENTER, 1, 2, NULL, 0);
{
switch(errtype)
{
case ERROR_MEMORY:
AddStaticText(4001,BFH_CENTER|BFV_CENTER,0,0, GeLoadString(ERROR_MEMORY_TEXT),BORDER_NONE);
AddStaticText(4003,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
break;
blah(blah,blah)...
default:
break;
}
}
GroupEnd();
AddStaticText(4004,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);
if (cancel) AddDlgGroup(DLG_OK|DLG_CANCEL);
else AddDlgGroup(DLG_OK);
GroupSpace(0,8);
}
GroupEnd();
return TRUE;
}
Note that I'm actually loading the image during the creation of the dialog. Probably not the best approach, but then error dialogs *shouldn't* (hehe) appear too often. The important stuff is between GroupBorderSpace(8,8,8,8) and GroupBegin(5001,...).
Robert