Hi Alex,
I suggested to use wgfil. For example:
----
int main ()
{
int ip = g.wgini ("vert");
int ip_file = g.wgfil (ip, "test", "d:\\", "*.cpp");
g.swgcbk (ip_file, FileNameSelect);
g.wgquit (ip);
g.wgfin ();
return 0;
}
void FileNameSelect(int id)
{ char s[257];
g.gwgfil (id, s);
std::cout << s << "\n";
}
------
The problem with your code is, that wgpop creates a popup menu, where you can
add menu entries with the routine wgapp and connect callback routines with the
menu entries. If you want to connect the popup menu directly with a callback routine,
you have to tell it Dislin with the option swgtyp ("string", "popup") before wgpop.
For example:
---
int main ()
{
int ip = g.wgini ("vert");
g.swgtyp ("string", "popup");
int ip_file = g.wgpop (ip, "File");
g.swgcbk (ip_file, FileNameSelect);
g.wgquit (ip);
g.wgfin ();
return 0;
}
void FileNameSelect(int id)
{ char s[257];
strcpy (s, "d:\\");
g.dwgfil ("Message", s, "*.cpp");
std::cout << s << "\n";
}
-----
It seems that the Windows file selection box has a problem with the pre-defined
file name 'd:'. It do not want pop up. So, please use 'd:\\', or something else.
If you want to have full control over the position and size of the main widget, you should
use a 'FORM' main widget, where you can define the size and position of each widget
with the routine swgwin. Otherwise, the size of the main widget is calculated from the
included child widgets. For example:
----
int main ()
{ int screen_width, screen_height;
int width = 800, height = 600, nx, ny;
g.getscr (&screen_width, &screen_height);
g.swgwin ((screen_width - width) / 2, (screen_height - height) / 2,
width, height);
int ip = g.wgini ("form");
g.wgfin ();
return 0;
}
----
With best regards,
Helmut