|
CPropertyPage::OnOK() will be called from CPropertySheet::OnOK(), and see here what does the default implementation of CPropertyPage::OnOk does.
CPropertyPage::OnOK
So When you are using the property page as simple dialog, call CDialog::OnOK() to get what you expect.
|
|
|
|
|
tab and esc key not working here.
|
|
|
|
|
Option is, when you are using property page as a dialog,let the messages be handled by CDialog rather than cPropertyPage. Over-ride PreTranslateMessage for this purpose.
BOOL CMyPropPage::PreTranslateMessage(MSG* pMsg)
{
return CDialog::PreTranslateMessage(pMsg);
}
seems crazy
If you are overriding OnCancel(), call CDialog::OnCancel() to dismiss the dialog on escape key.
|
|
|
|
|
You can use a single DIALOG resource in a CDialog derived and a CPropertyPage derived class. Use the same IDD identifier.
class MyPropPage : public CPropertyPage
{
enum { IDD = IDD_MYPAGE };
};
class CMyPropPageDlg : public CDialog
{
enum { IDD = IDD_MYPAGE };
};
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Le@rner wrote: please tell me how can i use Propetypage as dialog box.
This makes no sense. If you have a property sheet that contains one property page (i.e., tab), you effectively have a dialog box, albeit one that looks "oddly." Unless you have more than one page, just use a dialog box.
See here, here, here, and here for examples.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi all,
i m using CListCtrl in Report View,
here i m using 5 columns and 10 rows.
in 3rd column i want to use some link or option like more,and when use this option the data of 3rd column display in new window like dialog or message box.
please tell me how can i do this.
thanks in advance.
|
|
|
|
|
|
i dont want to use web links, i m just want to display the item of this item
|
|
|
|
|
okay.. I thought that you want to show the 3rd item as a link. Thats why.
Then Code-o-mat's comment below is worthy.
handle NM_CLICK notification and use CListCtrl::SubItemHitTest() there
void CMyDlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
NMITEMACTIVATE* p = (NMITEMACTIVATE*)pNMHDR;
CPoint pt = p->ptAction;
LVHITTESTINFO lvhti;
lvhti.pt = p->ptAction;
m_listctrl.SubItemHitTest(&lvhti);
if (lvhti.flags & LVHT_ONITEMLABEL)
{
CString cs;
cs.Format("Clicked SubItem %d", lvhti.iSubItem);
MessageBox(cs);
}
}
|
|
|
|
|
Well, i'd say, listen to NM_CLICK notifications from send by the list, in the handler use CListCtrl::HitTest to determine if the user clicked in the third column and if yes, do your business.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
|
Hi All,
VC++ 6, MFC, WinXP
My application's main interface consists of a FormView with a few controls – a tab control and a custom CView based control. In operation, the user *should* (yes, I know …not in the real world) click and then release the left mouse button in this view make a selection. The act of clicking starts a process and the act of releasing ends the process. Specifically, the application sends MIDI notes, similar to a piano keyboard control: MIDI note ON when the left mouse button is pressed, and MIDI note OFF when the button released. I need to send a MIDI note OFF message if the user drags out of the selection window - that would stop the note from playing when the mouse leaves the window. The idea is as long as the left mouse button is pressed, the note will play.
All works fine when the user clicks and releases in the same view but if they click, drag away, then release in a different view, the original view does not get notified and the selection remains - in other words, the note stays playing.
I’ve looked through the forums and articles and have tried a few of the suggestions but have yet not found any method to get notified immediately when the mouse leaves the active view if the left button is still down. Most of the methods have a "delayed action" before they notify the original view and only seem to trigger if the user clicks on another view - AFTER they released the left mouse initially on that non-original view. I need to find a way to get notified immediately should the mouse leave the active view when its left button is down.
Any suggestions and help would be appreciated.
Paul
|
|
|
|
|
See CWnd::SetCapture[^], this redirects all mouse messages to the given window until you either call ReleaseCapture or the mouse capture is lost because of some other event (then you get WM_MOUSECAPTURED[^] to notify you about this, you get this also when calling SetCapture/ReleaseCapture explicitly), alternatively, see TrackMouseEvent[^], maybe that better suits your needs.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
Works perfectly!
SetCapture() in the OnLButtonDown() handler and ReleaseCapture() in the OnLButtonUp() handler gives me better functionality. Now as long as the user lets go of the left mouse button anywhere, the view gets the mouse input and the OFF command is sent.
Thank you for the direction and the links (and lesson)!
Best Regards,
Paul
|
|
|
|
|
Yourwelcome. Just be careful, as i said, you might lose the mouse capture because of some "external" event, like a dialog box popping up from another application, and if you don't handle this correctly the user might need to click the correct spot in your application to trigger a button-up. I suggest, in OnLButtonDown, use SetCapture to grab the mouse input and start your midi play, in OnLButtonUp, use ReleaseCapture and in OnCaptureChanged, if you are loosing the capture, stop the sound. This way, both if the user releases the key or some other event triggers the capture-change, you won't end up with your program playing the sound endlessly.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
Oh, I have to admit I missed that suggestion before but it makes perfect sense. I've moved the code in OnLButtonUp()(keeping the ReleaseCapture() call) to OnCaptureChanged(). As is, it looks like it works in the same exact way as before but has the 'safety' features you stated. Thanks again!
Best Regards,
Paul
|
|
|
|
|
Yourwelcome, again.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
hello guys...I declared an array in one file MyClass.cpp, use it and then using the extern keyword I access it in MyProjDlg.cpp like this..
MyClass.cpp
-----------
LPTSTR Array[];
Arrar[index] = StudentName;
MyProjDlg.cpp
-------------
extern LPTSTR Array[];
BOOL CMyProjDlg::OnInitDialog()
{
...........
...........
Listbox.AddString(Array[index]);
}
But it is showing 3 errors, I dont know why?
MyClass.obj : error LNK2001: unresolved external symbol "char * * Array"
MyProjDlg.obj : error LNK2001: unresolved external symbol "char * * Array"
Debug/MyProj.exe : fatal error LNK1120: 1 unresolved external symbol
thnx
|
|
|
|
|
What you've done has many problems.
Instead you must do this -
You want to store many strings. So declare std::vector<std::string> Array;
To add to this array you do - Array.push_back(StudentName);
In the other file, declare it extern - extern std::vector<std::string> Array;
Now you can loop through this and use and index to access all elements as you've already done.
|
|
|
|
|
As «_Superman_» said, you've got lots of problems here. Firstly note these lines:
LPTSTR Array[];
Arrar[index] = StudentName;
You haven't allocated any storage for the array! Ask youself how big it is! You really should use a std::vector[^] (as «_Superman_» suggested), especially since you don't seem to have a grasp of basic memory managment. Try something like this:
MyClass.h
-----------
#include <string>
#include <vector>
extern std::vector<std::string> Array;
MyClass.cpp
-----------
#include "MyClass.h"
std::vector<std::string> Array;
MyProjDlg.cpp
-------------
#include "MyClass.h"
BOOL CMyProjDlg::OnInitDialog()
{
Array.push_back("String 1");
Array.push_back("String 2");
Listbox.AddString(Array[index].c_str());
}
Steve
|
|
|
|
|
thnx....this was really helpful...
|
|
|
|
|
I am passing float value to a varibale, but I am not getting correct value
float Val1=4.6;
float Val2 = Val1;//getting 4.5999999
I am getting 4.5999999, How can I get the return value as 4.6?
|
|
|
|
|
This is due to floating point precision. See here[^] (or google for it) for more information. If you really need more precision, you can always use a double (but I doubt that you need it).
|
|
|
|
|
Welcome to floating point math! Your result is typical and is why the #1 rule on doing floating point math is to never depend on the value being exact. You will need to compensate or use a higher precision number type, depending on what you are trying to accomplish.
In most situations the difference in calculated values is not significant, but sometimes it is. The worst resolution problems usually occur when you subtract 2 numbers that are close, then do further manipulations. If you are checking the value with if statements, for example, then you need to check that the value is within a reasonable tolerance.
Search around using Google and Bing for "floating point precision" and you should find lots of information.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Read here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|