// This function is called after the constructor but before it is displayed BOOL CDeleteDatumView::OnInitDialog() { CDialog::OnInitDialog(); FillListBox(); UpdateData(FALSE); return (TRUE); }
void CMotionsDlg::OnDeletemotion() { // remove a motion from the project and from the listbox // This will require us to re-initialize the listbox... int LbItem = m_MotionsList.GetCurSel (); if (LbItem != LB_ERR) { int Index = (int)m_MotionsList.GetItemData (LbItem); // remove it from the project if (AProject_RemoveMotion (m_Project, Index) == GE_FALSE) { AfxMessageBox (IDS_ERRORDELMOTION); } else { // Refill the listbox 'cause we've shifted motion entries FillListBox (); // and set the new current item if (LbItem >= m_MotionsList.GetCount ()) { --LbItem; } SetupCurrentItem (LbItem); UpdateData (FALSE); } } }
// // OnReceiveMessage // // Override CBasePropertyPage method. // Handles the messages for our property window // BOOL NullIPProperties::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: { // get the hWnd of the list box m_hwndLB = GetDlgItem (hwnd, IDC_MEDIALIST) ; FillListBox(); return (LRESULT) 1; } case WM_COMMAND: { if (HIWORD(wParam) == LBN_SELCHANGE) SetDirty(); return (LRESULT) 1; } } return CBasePropertyPage::OnReceiveMessage(hwnd,uMsg,wParam,lParam); } // OnReceiveMessage
BOOL CMotionsDlg::OnSetActive () { FillListBox (); SetupCurrentItem (0); UpdateData (FALSE); return TRUE; }
///////////////////////////////////////////////////////////////////////////// // TestAccessPlacementDefaults message handlers BOOL TestAccessPlacementDefaults::OnInitDialog() { CDialog::OnInitDialog(); FillListBox(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL KSceneModelPropertyPageLOD::OnInitDialog() { CPropertyPage::OnInitDialog(); m_ctlWeight.SetRange(0, 100); m_ctlWeight.SetPos(100); m_fWeight = 1.0f; FillListBox(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
static BOOL OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam) { HWND hwndIn = (HWND)lParam; HWND hwndList = GetDlgItem(hDlg, 100); SetProp(hDlg,gsPropName,(HANDLE)hwndIn); CenterWindowOnCursor(hDlg); FillListBox(hDlg,hwndIn); ListBox_SetCurSel(hwndList, 0); FORWARD_WM_NEXTDLGCTL(hDlg, hwndList, TRUE, PostMessage); return FALSE; }
BOOL CMotionsDlg::OnInitDialog() { CAStudioPropPage::OnInitDialog(); m_SpinOptLevel.SetRange (0, 9); FillListBox (); SetupCurrentItem (0); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void TestAccessPlacementDefaults::OnGenerate() { CString name; double size; name = "TEST_ACCESS"; // default 0.05 inches size = 0.05 * Units_Factor(UNIT_INCHES, doc->getSettings().getPageUnits()); generate_TestAccessGeometry(doc, name, size); // only show BLOCKTYPE_TEST_ACCESSPOINT FillListBox(); m_geometryLB.SelectString(-1, name); }
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,LPARAM lParam) { static HWND hwndList, hwndText ; int iIndex, iLength, cxChar, cyChar ; TCHAR * pVarName, * pVarValue ; switch (message) { case WM_CREATE : cxChar = LOWORD (GetDialogBaseUnits ()) ; cyChar = HIWORD (GetDialogBaseUnits ()) ; // Create listbox and static text windows. hwndList = CreateWindow (TEXT ("listbox"), NULL, WS_CHILD | WS_VISIBLE | LBS_STANDARD, cxChar, cyChar * 3, cxChar * 160 + GetSystemMetrics (SM_CXVSCROLL), cyChar * 5, hwnd, (HMENU) ID_LIST, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL) ; hwndText = CreateWindow (TEXT ("static"), NULL, WS_CHILD | WS_VISIBLE | SS_LEFT, cxChar, cyChar, GetSystemMetrics (SM_CXSCREEN), cyChar, hwnd, (HMENU) ID_TEXT, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL) ; FillListBox (hwndList) ; return 0 ; case WM_SETFOCUS : SetFocus (hwndList) ; return 0 ; case WM_COMMAND : if (LOWORD (wParam) == ID_LIST && HIWORD (wParam) == LBN_SELCHANGE) { // Get current selection. iIndex = SendMessage (hwndList, LB_GETCURSEL, 0, 0) ; iLength = SendMessage (hwndList, LB_GETTEXTLEN, iIndex, 0) + 1 ; pVarName = (TCHAR*)calloc (iLength, sizeof (TCHAR)) ; SendMessage (hwndList, LB_GETTEXT, iIndex, (LPARAM) pVarName) ; // Get environment string. iLength = GetEnvironmentVariable (pVarName, NULL, 0) ; pVarValue = (TCHAR*)calloc (iLength, sizeof (TCHAR)) ; GetEnvironmentVariable (pVarName, pVarValue, iLength) ; // Show it in window. SetWindowText (hwndText, pVarValue) ; free (pVarName) ; free (pVarValue) ; } return 0 ; case WM_DESTROY : PostQuitMessage (0) ; return 0 ; } return DefWindowProc (hwnd, message, wParam, lParam) ; }
int CMainWindow::OnCreate (LPCREATESTRUCT lpcs) { if (CWnd::OnCreate (lpcs) == -1) return -1; // // Create an 8-point MS Sans Serif font to use in the controls. // m_fontMain.CreatePointFont (80, _T ("MS Sans Serif")); // // Compute the average width and height of a character in the font. // CClientDC dc (this); CFont* pOldFont = dc.SelectObject (&m_fontMain); TEXTMETRIC tm; dc.GetTextMetrics (&tm); m_cxChar = tm.tmAveCharWidth; m_cyChar = tm.tmHeight + tm.tmExternalLeading; dc.SelectObject (pOldFont); // // Create the controls that will appear in the FontView window. // CRect rect (m_cxChar * 2, m_cyChar, m_cxChar * 48, m_cyChar * 2); m_wndLBTitle.Create (_T ("Typefaces"), WS_CHILD | WS_VISIBLE | SS_LEFT, rect, this); rect.SetRect (m_cxChar * 2, m_cyChar * 2, m_cxChar * 48, m_cyChar * 18); m_wndListBox.CreateEx (WS_EX_CLIENTEDGE, _T ("listbox"), NULL, WS_CHILD | WS_VISIBLE | LBS_STANDARD, rect, this, IDC_LISTBOX); rect.SetRect (m_cxChar * 2, m_cyChar * 19, m_cxChar * 48, m_cyChar * 20); m_wndCheckBox.Create (_T ("Show TrueType fonts only"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, rect, this, IDC_CHECKBOX); rect.SetRect (m_cxChar * 2, m_cyChar * 21, m_cxChar * 66, m_cyChar * 25); m_wndGroupBox.Create (_T ("Sample"), WS_CHILD | WS_VISIBLE | BS_GROUPBOX, rect, this, (UINT) -1); rect.SetRect (m_cxChar * 4, m_cyChar * 22, m_cxChar * 64, (m_cyChar * 99) / 4); m_wndSampleText.Create (_T (""), WS_CHILD | WS_VISIBLE | SS_CENTER, rect, this, IDC_SAMPLE); rect.SetRect (m_cxChar * 50, m_cyChar * 2, m_cxChar * 66, m_cyChar * 4); m_wndPushButton.Create (_T ("Print Sample"), WS_CHILD | WS_VISIBLE | WS_DISABLED | BS_PUSHBUTTON, rect, this, IDC_PRINT); // // Set each control's font to 8-point MS Sans Serif. // m_wndLBTitle.SetFont (&m_fontMain, FALSE); m_wndListBox.SetFont (&m_fontMain, FALSE); m_wndCheckBox.SetFont (&m_fontMain, FALSE); m_wndGroupBox.SetFont (&m_fontMain, FALSE); m_wndPushButton.SetFont (&m_fontMain, FALSE); // // Fill the list box with typeface names and return. // FillListBox (); return 0; }
void CMainWindow::OnCheckBoxClicked () { FillListBox (); OnSelChange (); }
LRESULT CALLBACK SelectDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { int index,pt[1],*selitems,num,selnum; char str[MAX_PATH+200],ext[6]; RECT rect; LONG pwidth; DWORD i,read; RFile *list,*last; static CheckedArchive *pca; static GRPDirEntry *table; switch (uMsg) { case WM_INITDIALOG: pca=(CheckedArchive*)lParam; CenterWindow(hwnd,GetWindow(hwnd,GW_OWNER)); wsprintf(str,"Select files to process from archive: %s",GetFileTitleEx(pca->resname)); SetWindowText(hwnd,str); GetClientRect(GetDlgItem(hwnd,ID_PROGRESS),&rect); pwidth=rect.right-rect.left; GetClientRect(GetDlgItem(hwnd,ID_STATUS),&rect); pt[0]=rect.right-pwidth-6; SendDlgItemMessage(hwnd,ID_STATUS,SB_SETPARTS,1,(LPARAM)pt); SendDlgItemMessage(hwnd,ID_PROGRESS,PBM_SETRANGE,0,MAKELPARAM(0,100)); SendDlgItemMessage(hwnd,ID_PROGRESS,PBM_SETPOS,0,0L); GetClientRect(GetDlgItem(hwnd,ID_LIST),&rect); pt[0]=(rect.right-rect.left)/4; SendDlgItemMessage(hwnd,ID_LIST,LB_SETTABSTOPS,1,(LPARAM)pt); SendDlgItemMessage(hwnd,ID_FILTER,CB_ADDSTRING,0,(LPARAM)"*.*"); SendDlgItemMessage(hwnd,ID_FILTER,CB_SETCURSEL,(WPARAM)0,0L); ShowWindow(hwnd,SW_SHOWNORMAL); SendDlgItemMessage(hwnd,ID_STATUS,SB_SETTEXT,0,(LPARAM)"Allocating memory for list..."); SendDlgItemMessage(hwnd,ID_LIST,LB_INITSTORAGE,(WPARAM)(pca->number),(LPARAM)(pca->number*25)); table=(GRPDirEntry*)GlobalAlloc(GPTR,(pca->number)*sizeof(GRPDirEntry)); if (table==NULL) { EndDialog(hwnd,(int)NULL); return TRUE; } SendDlgItemMessage(hwnd,ID_STATUS,SB_SETTEXT,0,(LPARAM)"Reading GRP file directory..."); ReadFile(pca->rf,table,(pca->number)*sizeof(GRPDirEntry),&read,NULL); if (read<(pca->number)*sizeof(GRPDirEntry)) { GlobalFree(table); EndDialog(hwnd,(int)NULL); return TRUE; } SendDlgItemMessage(hwnd,ID_STATUS,SB_SETTEXT,0,(LPARAM)"Filling file list..."); FillListBox(hwnd,table,pca->number,NULL); SendDlgItemMessage(hwnd,ID_STATUS,SB_SETTEXT,0,(LPARAM)"Ready"); return TRUE; case WM_CLOSE: GlobalFree(table); EndDialog(hwnd,(int)NULL); break; case WM_COMMAND: switch (LOWORD(wParam)) { case ID_LIST: switch (HIWORD(wParam)) { case LBN_DBLCLK: case LBN_KILLFOCUS: case LBN_SETFOCUS: case LBN_SELCANCEL: case LBN_SELCHANGE: // TODO: ??? break; default: break; } break; case ID_FILTER: if (HIWORD(wParam)==CBN_SELCHANGE) { index=(int)SendDlgItemMessage(hwnd,ID_FILTER,CB_GETCURSEL,(WPARAM)0,0L); if (index==CB_ERR) break; SendDlgItemMessage(hwnd,ID_FILTER,CB_GETLBTEXT,(WPARAM)index,(LPARAM)ext); SendDlgItemMessage(hwnd,ID_STATUS,SB_SETTEXT,0,(LPARAM)"Filtering list..."); FillListBox(hwnd,table,(pca->number),ext); SendDlgItemMessage(hwnd,ID_STATUS,SB_SETTEXT,0,(LPARAM)"Ready"); } break; case ID_SELALL: num=(int)SendDlgItemMessage(hwnd,ID_LIST,LB_GETCOUNT,(WPARAM)0,(LPARAM)0L); SendDlgItemMessage(hwnd,ID_LIST,LB_SELITEMRANGE,(WPARAM)TRUE,MAKELPARAM(0,num-1)); break; case ID_SELNONE: num=(int)SendDlgItemMessage(hwnd,ID_LIST,LB_GETCOUNT,(WPARAM)0,(LPARAM)0L); SendDlgItemMessage(hwnd,ID_LIST,LB_SELITEMRANGE,(WPARAM)FALSE,MAKELPARAM(0,num-1)); break; case ID_INVERT: selnum=(int)SendDlgItemMessage(hwnd,ID_LIST,LB_GETSELCOUNT,0,0L); selitems=(int*)LocalAlloc(LPTR,selnum*sizeof(int)); SendDlgItemMessage(hwnd,ID_LIST,LB_GETSELITEMS,(WPARAM)selnum,(LPARAM)selitems); num=(int)SendDlgItemMessage(hwnd,ID_LIST,LB_GETCOUNT,(WPARAM)0,(LPARAM)0L); SendDlgItemMessage(hwnd,ID_LIST,LB_SELITEMRANGE,(WPARAM)TRUE,MAKELPARAM(0,num-1)); SendDlgItemMessage(hwnd,ID_STATUS,SB_SETTEXT,0,(LPARAM)"Inverting selection..."); SendDlgItemMessage(hwnd,ID_PROGRESS,PBM_SETPOS,(UINT)0,0L); for (index=0;index<selnum;index++) { SendDlgItemMessage(hwnd,ID_LIST,LB_SETSEL,(WPARAM)FALSE,(LPARAM)selitems[index]); SendDlgItemMessage(hwnd,ID_PROGRESS,PBM_SETPOS,MulDiv(100,index+1,selnum),0L); } SendDlgItemMessage(hwnd,ID_PROGRESS,PBM_SETPOS,(UINT)0,0L); SendDlgItemMessage(hwnd,ID_STATUS,SB_SETTEXT,0,(LPARAM)"Ready"); LocalFree(selitems); break; case IDCANCEL: GlobalFree(table); EndDialog(hwnd,(int)NULL); break; case IDOK: SendDlgItemMessage(hwnd,ID_STATUS,SB_SETTEXT,0,(LPARAM)"Checking selection..."); SendDlgItemMessage(hwnd,ID_PROGRESS,PBM_SETPOS,(UINT)0,0L); selnum=(int)SendDlgItemMessage(hwnd,ID_LIST,LB_GETSELCOUNT,0,0L); selitems=(int*)LocalAlloc(LPTR,selnum*sizeof(int)); SendDlgItemMessage(hwnd,ID_LIST,LB_GETSELITEMS,(WPARAM)selnum,(LPARAM)selitems); list=NULL; last=NULL; for (index=0;index<selnum;index++) { i=(DWORD)SendDlgItemMessage(hwnd,ID_LIST,LB_GETITEMDATA,(WPARAM)selitems[index],0L); if (i!=LB_ERR) { AddFile(&list,&last,i,table+i); SendDlgItemMessage(hwnd,ID_PROGRESS,PBM_SETPOS,MulDiv(100,index+1,selnum),0L); } } SendDlgItemMessage(hwnd,ID_PROGRESS,PBM_SETPOS,(UINT)0,0L); LocalFree(selitems); GlobalFree(table); EndDialog(hwnd,(int)list); break; default: break; } break; default: break; } return FALSE; }
void CMotionsDlg::OnRenamemotion() { // Rename the motion. // Get name. Make sure it's unique. // Will have to remove and re-insert it in the listbox. int LbItem = m_MotionsList.GetCurSel (); if (LbItem == LB_ERR) { // no current item return; } // get current name CString OldMotionName = ""; m_MotionsList.GetText (LbItem, OldMotionName); CTextInputDlg Dlg (IDS_NEWNAMEPROMPT, OldMotionName, this); // Prompt user for new name if (Dlg.DoModal () == IDOK) { // Make sure the new name doesn't already exist const CString NewMotionName = Dlg.m_Text; int Index = AProject_GetMotionIndex (m_Project, NewMotionName); if (Index == -1) { // valid name entered. // Get item index from the listbox. Index = m_MotionsList.GetItemData (LbItem); // First try to add the new motion to the listbox. LbItem = m_MotionsList.AddString (NewMotionName); if ((LbItem == LB_ERR) || (LbItem == LB_ERRSPACE)) { // couldn't add new motion AfxMessageBox (IDS_ERRORADDMOTION); } else { // attach motion to name m_MotionsList.SetItemData (LbItem, Index); // Change the name of this motion in the project. AProject_SetMotionName (m_Project, Index, NewMotionName); // Set this as the new current selection m_MotionsList.SetCurSel (LbItem); // and delete the old one... LbItem = m_MotionsList.FindStringExact (-1, OldMotionName); if (LbItem != LB_ERR) { m_MotionsList.DeleteString (LbItem); } // refill the listbox 'cause we've shifted entries FillListBox (); // and set the new current item LbItem = m_MotionsList.FindStringExact (-1, NewMotionName); SetupCurrentItem (LbItem); } } else { // Motion exists in the project. Tell user about it. CString Msg; AfxFormatString1 (Msg, IDS_MOTIONEXISTS, NewMotionName); AfxMessageBox (Msg); } } }
static INT_PTR CALLBACK DefInpProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { switch (Msg) { case WM_INITDIALOG: { hIpsDlg = hDlg; hWhiteBGBrush = CreateSolidBrush(RGB(0xFF,0xFF,0xFF)); hPreview = PNGLoadBitmap(hIpsDlg, NULL, 304, 228, 2); SendDlgItemMessage(hIpsDlg, IDC_SCREENSHOT_H, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hPreview); LONG_PTR Style; Style = GetWindowLongPtr (GetDlgItem(hIpsDlg, IDC_TREE1), GWL_STYLE); Style |= TVS_CHECKBOXES; SetWindowLongPtr (GetDlgItem(hIpsDlg, IDC_TREE1), GWL_STYLE, Style); IpsManagerInit(); WndInMid(hDlg, hScrnWnd); SetFocus(hDlg); // Enable Esc=close break; } case WM_COMMAND: { int wID = LOWORD(wParam); int Notify = HIWORD(wParam); if (Notify == BN_CLICKED) { switch (wID) { case IDOK: { IpsOkay(); break; } case IDCANCEL: { SendMessage(hDlg, WM_CLOSE, 0, 0); return 0; } case IDC_IPSMAN_DESELECTALL: { for (int i = 0; i < nNumPatches; i++) { for (int j = 0; j < nNumPatches; j++) { _TreeView_SetCheckState(hIpsList, hPatchHandlesIndex[j], FALSE); } } break; } } } if (wID == IDC_CHOOSE_LIST && Notify == CBN_SELCHANGE) { nIpsSelectedLanguage = SendMessage(GetDlgItem(hIpsDlg, IDC_CHOOSE_LIST), CB_GETCURSEL, 0, 0); TreeView_DeleteAllItems(hIpsList); FillListBox(); RefreshPatch(); return 0; } break; } case WM_NOTIFY: { NMHDR* pNmHdr = (NMHDR*)lParam; if (LOWORD(wParam) == IDC_TREE1 && pNmHdr->code == TVN_SELCHANGED) { RefreshPatch(); return 1; } if (LOWORD(wParam) == IDC_TREE1 && pNmHdr->code == NM_DBLCLK) { // disable double-click node-expand SetWindowLongPtr(hIpsDlg, DWLP_MSGRESULT, 1); return 1; } if (LOWORD(wParam) == IDC_TREE1 && pNmHdr->code == NM_CLICK) { POINT cursorPos; GetCursorPos(&cursorPos); ScreenToClient(hIpsList, &cursorPos); TVHITTESTINFO thi; thi.pt = cursorPos; TreeView_HitTest(hIpsList, &thi); if (thi.flags == TVHT_ONITEMSTATEICON) { TreeView_SelectItem(hIpsList, thi.hItem); } return 1; } SetWindowLongPtr(hIpsDlg, DWLP_MSGRESULT, CDRF_DODEFAULT); return 1; } case WM_CTLCOLORSTATIC: { if ((HWND)lParam == GetDlgItem(hIpsDlg, IDC_TEXTCOMMENT)) { return (INT_PTR)hWhiteBGBrush; } break; } case WM_CLOSE: { IpsManagerExit(); break; } } return 0; }
static int IpsManagerInit() { // Get the games full name TCHAR szText[1024] = _T(""); TCHAR* pszPosition = szText; TCHAR* pszName = BurnDrvGetText(DRV_FULLNAME); pszPosition += _sntprintf(szText, 1024, pszName); pszName = BurnDrvGetText(DRV_FULLNAME); while ((pszName = BurnDrvGetText(DRV_NEXTNAME | DRV_FULLNAME)) != NULL) { if (pszPosition + _tcslen(pszName) - 1024 > szText) { break; } pszPosition += _stprintf(pszPosition, _T(SEPERATOR_2) _T("%s"), pszName); } _tcscpy(szFullName, szText); _stprintf(szText, _T("%s") _T(SEPERATOR_1) _T("%s"), FBALoadStringEx(hAppInst, IDS_IPSMANAGER_TITLE, true), szFullName); // Set the window caption SetWindowText(hIpsDlg, szText); // Fill the combo box _stprintf(szLanguages[0], _T("English (US)")); _stprintf(szLanguages[1], _T("Simplified Chinese")); _stprintf(szLanguages[2], _T("Traditional Chinese")); _stprintf(szLanguages[3], _T("Japanese")); _stprintf(szLanguages[4], _T("Korean")); _stprintf(szLanguages[5], _T("French")); _stprintf(szLanguages[6], _T("Spanish")); _stprintf(szLanguages[7], _T("Italian")); _stprintf(szLanguages[8], _T("German")); _stprintf(szLanguages[9], _T("Portuguese")); _stprintf(szLanguages[10], _T("Polish")); _stprintf(szLanguages[11], _T("Hungarian")); _stprintf(szLanguageCodes[0], _T("en_US")); _stprintf(szLanguageCodes[1], _T("zh_CN")); _stprintf(szLanguageCodes[2], _T("zh_TW")); _stprintf(szLanguageCodes[3], _T("ja_JP")); _stprintf(szLanguageCodes[4], _T("ko_KR")); _stprintf(szLanguageCodes[5], _T("fr_FR")); _stprintf(szLanguageCodes[6], _T("es_ES")); _stprintf(szLanguageCodes[7], _T("it_IT")); _stprintf(szLanguageCodes[8], _T("de_DE")); _stprintf(szLanguageCodes[9], _T("pt_BR")); _stprintf(szLanguageCodes[10], _T("pl_PL")); _stprintf(szLanguageCodes[11], _T("hu_HU")); for (int i = 0; i < NUM_LANGUAGES; i++) { SendDlgItemMessage(hIpsDlg, IDC_CHOOSE_LIST, CB_ADDSTRING, 0, (LPARAM)&szLanguages[i]); } SendDlgItemMessage(hIpsDlg, IDC_CHOOSE_LIST, CB_SETCURSEL, (WPARAM)nIpsSelectedLanguage, (LPARAM)0); hIpsList = GetDlgItem(hIpsDlg, IDC_TREE1); FillListBox(); CheckActivePatches(); return 0; }