|
|
If anyone can give me direction as to modifying the Crystal Report default path to ...\MyDocuments\. I would appreciate it.
I am working on an application using C++/MFC, which creates reports (using crystal reports), but the default path is preferred to be in the My Documents folder. Otherwise, to the path set previously by the application's operator. I am using Crystal Reports (version 8.5).
Thanks.
modified on Monday, April 28, 2008 8:53 AM
|
|
|
|
|
Hi All, Look at the following code snippet. My aim is to disable the button for some time say 2 seconds and enable it thereafter. What i noticed if i repeatedly click the button before 2 seconds lapsed then the all clicks i did get queued even the button itself was disabled at the very first click. The result of above said is that the all queued events get called one by one. Which is not desirable and i am able to notice as many traces as the clicks i did before 2 secs in my output window.
my aim is simple. I just don't want the button's handler to be called after the same gets disabled.
void CMYDlg::OnMyButton()
{
m_mybtn.EnableWindow(false);//disable button on its own click handler
Sleep(3000);
TRACE("___demo___");
m_mybtn.EnableWindow(true);
}
Your help and suggestion will be highly appreciated...
thanks
Raman
|
|
|
|
|
hey if any of you have problem understanding my question then please reply to this thread.
|
|
|
|
|
Member 3068970 wrote: Sleep(3000);
You can't put a simple in there. You will block your main thread (which is the UI thread too) meaning that no message will be processed. So, all your clicks will still be queued. You have to use a timer to simulate such behavior. Disable the button and start the timer in OnMyButton and re-enable the button once the timer fired.
|
|
|
|
|
|
Use a timer (WM_TIMER) instead of a Sleep.
When the user clicks on the button, disable the button, start the timer, and when the timer ellapse, re-enable the button.
|
|
|
|
|
Don't do that in a event handler. Set a one-shot timer for the purpose, for instance:
int iMyTimer = 100;
void CMYDlg::OnMyButton()
{
m_mybtn.EnableWindow(false);
iMyTimer = SetTimer(iMyTimer, 3000, NULL);
}
void CMYDlg::OnTimer(UINT_PTR nIDEvent)
{
if ( nIDEvent == iMyTimer)
{
m_mybtn.EnableWindow(true);
KillTimer(iMyTimer);
}
CDialog::OnTimer(nIDEvent);
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
i got it.thanks a lot.
|
|
|
|
|
Even though it goes against your design, Windows is actually not doing anything wrong or unexpected since neither the button control nor the dialog itself are responding to the mouse click while the button is disabled. It's not until the button is enabled that it resumes processing messages. Use Spy++ to verify.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Member 3068970 wrote: oh its very true...
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have a simple dialog with a progress control bar and some static text in it.
If I make the dialog modal Dlg.DoModal() there is no problem. But when I show it with Dlg.Create(IDD_PROGDLG, NULL); Dlg.ShowWindow(SW_SHOW); The text does not appear.
What am I doing wrong??
|
|
|
|
|
piul wrote: If I make the dialog modal Dlg.DoModal() there is no problem. But when I show it with Dlg.Create(IDD_PROGDLG, NULL); Dlg.ShowWindow(SW_SHOW); The text does not appear.
Are you dynamically creating this static control?
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
No. I put it when drawing the dialog.
|
|
|
|
|
piul wrote: No. I put it when drawing the dialog.
Can you show us the code where you are doing this?
Most probably it's(static) a local object that's why it's working with DoModal and not working with Create and ShowWindow , since DoModal blocks till the dialog is closed but this is not the case with Create and ShowWindow , they don't block so your static control will get destroyed hence it's not visible.
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
The header file:
class CProgressDlg : public CDialog
{
DECLARE_DYNAMIC(CProgressDlg)
public:
CProgressDlg(int nNoteNum = 0, CWnd* pParent = NULL);
virtual ~CProgressDlg();
void UpdateBar(int nFoundSoFar = 0) ;
enum { IDD = IDD_PROGDLG };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
DECLARE_MESSAGE_MAP()
public:
CProgressCtrl m_ProgBar;
int m_nTotNoteNum ;
BOOL m_bInit ;
};
the source file:
IMPLEMENT_DYNAMIC(CProgressDlg, CDialog)
CProgressDlg::CProgressDlg(int nNoteNum, CWnd* pParent)
: CDialog(CProgressDlg::IDD, pParent)
{
m_nTotNoteNum = nNoteNum ;
m_bInit = FALSE ;
}
CProgressDlg::~CProgressDlg()
{
}
void CProgressDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_PROGRESS1, m_ProgBar);
}
void CProgressDlg::UpdateBar(int nFoundSoFar)
{
if (!m_bInit)
{
OnInitDialog() ;
m_ProgBar.SendMessage(PBM_SETRANGE, 0, MAKELPARAM(0, m_nTotNoteNum));
m_ProgBar.SendMessage(PBM_SETSTEP, (WPARAM) 1, 0);
m_bInit = TRUE ;
}
m_ProgBar.SendMessage(PBM_STEPIT, 0, 0) ;
}
BEGIN_MESSAGE_MAP(CProgressDlg, CDialog)
END_MESSAGE_MAP()
|
|
|
|
|
It's very strange... I've just tried to do the same in a different project and it works all right.
And any other item that I add to the dialog does not show either. I've tried adding buttons and stuff and they just don' appear.
|
|
|
|
|
Is this a dialog based app and the dialog is the main dialog?
|
|
|
|
|
Are you sure its visible?
|
|
|
|
|
Hi
I am using CListCtrl. When using CListCtrl with Imagelist in the "ICON" view - for the inserted items , by default text will come at the bottom of the Icon. How to change so that "Text" will come in the front ( at right side ) of the ICON.
|
|
|
|
|
|
Hi guys,
As the subject points out I'd like to restrict the movement of an (owned ?) WS_POPUP to the client area of its owner. Contrary to the behaviour of a WS_CHILD which is clipped when it hits the boundaries of its parent (you can push the child under the borders) - I'd like my window to "bounce" of the borders (you can not push it under the borders, it should behave as hitting a wall). Is this possible ? If yes how can I tackle the problem ? Based on my pretty meager windows programming knowledge I'd say I need to trap/catch/grab some windows messages ( but which ones ? ) and then do something with them (probably subclassing the windowproc of the WS_POPUP ?). I can truly say I have no idea where to start. Can anybody provide some hints ? Maybe you have already done what I would need and can furnish same coding example ?
Sorry child windows are completely out of the question - not for the clipping behaviour but for other reasons as well!
thanx,
codingworm
|
|
|
|
|
WM_MOVING [^] [^] looks interesting.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
modified on Tuesday, April 29, 2008 9:12 AM
|
|
|
|
|
Globalization?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|