ERLEDIGT
JA
JA
ANTWORTEN
1
1
ZUGRIFFE
1014
1014
EMPFEHLEN
-
Hallo zusammen,
um es kurz zu halten der Kern des Problems ist, das bei einigen Forms "OnToolHitTest" immer "-1" liefert und bei einigen ganz korrekt die Steuerelement ID.
Ich hab mir jetzt den ganzen Tag nen Wolf gesucht, aber ich komme nicht dahinter was das Problem ist...
"OnHelpHitTest" wird richtig aufgerufen bei Verwendung des What´s this Zeigers, aber wie gesagt bei bestimmten Forms klappts immer und bei manchen nie! Die relevanten Codestellen sind identisch...
Ich komme nicht weiter und freu mich über jede Art von Anregung!
Hier ein bisle Code:
Habe inzwischen verschiedene Varianten probiert, aber keine bringt irgendeine Veränderung, da "OnToolHitTest" immer -1 liefert bei den Problematischen Forms...
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
LRESULT CVelocityView::OnHelpHitTest(WPARAM, LPARAM lParam) { ASSERT_VALID(this); // Find the child window ID under mouse cursor POINT point = { LOWORD(lParam), HIWORD(lParam) }; int nID = OnToolHitTest(point, NULL); // Workaround, um Kontexthilfe v. Controls anzuzeigen, // die innerhalb von statischen Controls mit höherer Z-Order liegen if (nID == IDC_SPEED_STATIC) { CRect rcClient; CWnd* pWnd = GetDlgItem(nID); while (1) { pWnd = pWnd->GetNextWindow(); if (pWnd == NULL) { break; } pWnd->GetWindowRect(rcClient); ScreenToClient(rcClient); if (rcClient.PtInRect(point)) { nID = pWnd->GetDlgCtrlID(); break; } } } if (nID != -1) return HID_BASE_CONTROL+nID; nID = GetDlgCtrlID(); return nID != 0 ? HID_BASE_CONTROL+nID : 0; }
Code :1 2 3 4 5 6 7 8 9 10 11 12
LRESULT CBasicSetupView::OnHelpHitTest(WPARAM wParam, LPARAM lParam) { ASSERT_VALID(this); // Find the child window ID under mouse cursor int nID = OnToolHitTest((DWORD)lParam, NULL); if (nID != -1) return HID_BASE_CONTROL+nID; nID = GetDlgCtrlID(); return nID != 0 ? HID_BASE_CONTROL+nID : 0; }
Viele Grüße
RuFF
-
Nach sehr langer und intensiver Suche habe ich das Problem gefunden!
Es klappt einfach nicht wenn ein Control sich innerhalb einer GroupBox befinden dessen ID: IDC_STATIC ist.
Also einfach die GroupBox umbennen und es klappt... *kotz*
Ich zitiere einfach:
Zu finden hier: https://connect.microsoft.com/Visual...&wa=wsignin1.0We found one bug in the latest version of MFC (version 9.0 from Visual Studio 2008). As compared with MFC from Visual Studio 6.0 the macros _AfxGetDlgCtrlID was changed.
// MFC 4.2 - see line 418 of the file \VC\atlmfc\src\mfc\afximpl.h
#define _AfxGetDlgCtrlID(hWnd) ((UINT)(WORD)::GetDlgCtrlID(hWnd))
// MFC 9.0 - see line 528 of the file "\VC98\MFC\SRC\afximpl.h"
#define _AfxGetDlgCtrlID(hWnd) ((UINT)::GetDlgCtrlID(hWnd))
This change leads to the following bug. If we have a control (for example, Button) situated inside Group-box control with ID=IDC_STATIC, message TTN_NEEDTEXT for this Button will not be received and tooltips for this Button will disappear, because function OnToolHitTest from \VC\atlmfc\src\mfc\wincore.cpp, (line 1087) operates erroneously.
Viele Grüße
RuFF
Ähnliche Themen
-
Richtige Syntax bei Operatorüberladung, wann sind "friend", "const", "&" nötig?
Von mrs_schokokeks im Forum C/C++Antworten: 4Letzter Beitrag: 25.08.10, 19:13 -
Uebungen "Abstimmung" Zeiger & Array
Von _BlueScreen im Forum C/C++Antworten: 1Letzter Beitrag: 10.03.08, 09:04 -
IE6 problem mit bild, das aus div container "herausragt" ("left:-100px")
Von Not so much B im Forum CSSAntworten: 1Letzter Beitrag: 16.08.07, 04:21 -
flash Problem - sendAndLoad("mailto.php", LV, "POST")
Von MikeTurrento im Forum Flash PlattformAntworten: 5Letzter Beitrag: 01.06.06, 11:11 -
Implementierung des Pattern "Observer"
Von the_lorn im Forum .NET ArchivAntworten: 2Letzter Beitrag: 03.08.04, 17:36





Zitieren
Login






