PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

My DialogBox

Has made idle time Dialogbox.
But I can not understand where a mistake.
If dialogue is started and at this time to close the application.
The mistake jumps out. (the PC).
Code:

short Dialog_box(ClassEDisplay *display,char* str_cap,char* str_msg,int tp_box,int dW=180,int dH=150)
{
short res=0;
MSG msg;

Back_fon.BltFast(0,0,&display->buffer,NULL);

for (int x=0;x<mW/2;x++)
for (int y=0;y<mH/2;y++)
Back_fon.PutPixel(x<<1,y<<1,0);


while (res==0)
{
display->buffer.Clear(0);
display->buffer.BltFast(0,0,&Back_fon,NULL,EFX_OPACITY,200); //,EFX_OPACITY,220

.......................
.......................

switch(tp_box)
{
case 1:
if (Button(display,Dx+dW/2-70,Dy+dH-30,&img_butons,&r) )
res=DIALOG_BOX_BUTTON_YES;

SetRect(&r,34,20,34+68,40);
if (Button(display,Dx+dW/2,Dy+dH-30,&img_butons,&r) )
res=DIALOG_BOX_BUTTON_NO;
break;

default:
if (Button(display,Dx+dW/2-15,Dy+dH-30,&img_butons,&r) )
res=DIALOG_BOX_BUTTON_YES;
break;
}

if (res==0)
{
display->Flip();
bRet=GetMessage(&msg, (HWND)hWnd, 0, 0);
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return res;
}


Thanks.
Hi Relo,

Is your dialog box a native dialogbox from your program resources, or is it custom made?

The following code:

Code:

bRet=GetMessage(&msg;, (HWND)hWnd, 0, 0);
TranslateMessage(&msg;);
DispatchMessage(&msg;);


seems responsible for your crash. Can you tell me why you're using these functions?
Yes it is my custom dialogue, I should make for example by pressing the menu an output, dialogue of acknowledgement.
I.e. the user presses the menu "quit", there is a dialogue and if the user has chosen "yes" (to leave game), the program is closed, if there is "no" dialogue simply vanishes.

Somehow on another it can is possible to realize it??
Hi Relo,

I still don't understand why you're using functions like TranslateMessage(&msg;). Can you tell me why you're using these? Also, what happens if you don't call these functions?
Code:
if (Menu_Item_Selected && MENU_ID==MN_ID_QUIT)
{
if (Dialog_box(display,"Attention","You really wish to quit ?",1)==DIALOG_BOX_BUTTON_YES)
Quit();
}



How it is possible to make on another it??
If I shall clean in function of dialog box:
bRet=GetMessage(&msg;, (HWND)hWnd, 0, 0);
TranslateMessage(&msg;);
DispatchMessage(&msg;);

At me the application will simply hang(not response).
(I should process pressing of buttons and stylus)

I wish to make dialog box as on a picture.
Image
Hi Relo,

If I look at your picture, it shows that you shouldn't use any win32 window API's. Perhaps you're adding standard windows button controls on the EDGELIB window?

I recommend taking a good look at your user interface functions/classes and rebuild them as necessary. Also don't forget to forward your input events (such as key presses and stylus movements/presses) to your user interface.