I would like to have the "minimize to tray" feature (under Windows). Does anyone has a solution or code for that ?
Marten
Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig
nmongeau wrote:I've never done it in Smalltalk, but I have C++ code that handles it if you're interested.
| nid flags osString dwMessage res message |
nid := OSNotifyicondata new.
flags := (PlatformConstants at: 'NifIcon') + (PlatformConstants at: 'NifMessage') + (PlatformConstants at: 'NifTip').
dwMessage := PlatformConstants at: 'NimAdd'.
osString := 'Some Text For Tool Tip' copyToOSMemory.
message := (PlatformConstants at: 'WmUser') + 1997.
nid
cbSize: OSNotifyicondata fixedSize ;
hWnd: self primaryWidget osWidget handle ;
uID: 1234 ;
uFlags: flags ;
uCallbackMessage: message ;
hIcon: (OSWidget systemIcon: (PlatformWidgetsConstants at: 'OSxICONQUESTION')) ;
szTip: osString.
res := OSCall new shellNotifyIcon: dwMessage lpData: nid.
LONG CClipboardDlg::OnMyTrayNotify(WPARAM wParam, LPARAM lParam)
{
switch ( lParam )
{
case WM_LBUTTONDBLCLK:
// Display the application
ShowWindow(SW_RESTORE);
SetForegroundWindow();
break;
//Activate the pop up menu
case WM_RBUTTONDOWN:
//Create the popup menu with mini icons
CMenu menu;
VERIFY( menu.CreatePopupMenu() );
if ((! IsWindowVisible()) | IsIconic())
{
menu.AppendMenu(MF_STRING, ID_APP_OPEN, _T("&Open"));
}
else
{
menu.AppendMenu(MF_STRING | MF_GRAYED, ID_APP_OPEN, _T("&Open"));
};
menu.AppendMenu(MF_STRING, ID_APP_REALLY_EXIT, _T("E&xit") );
//Position and Display
POINT pt ;
GetCursorPos ( &pt ) ;
SetForegroundWindow();
int nSelection = menu.TrackPopupMenu (
TPM_RETURNCMD | TPM_LEFTALIGN | TPM_RIGHTBUTTON,
pt.x, pt.y, AfxGetMainWnd(), NULL );
menu.DestroyMenu();
switch( nSelection )
{
case ID_APP_OPEN:
ShowWindow(SW_RESTORE);
break;
case ID_APP_REALLY_EXIT:
OnCancel();
break;
}
};
return 0;
}
Return to VA Smalltalk 7.0, 7.5 & 8.0
Users browsing this forum: Yahoo [Bot] and 1 guest