|
Show us the code inside the browse button handler.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
CFileDialog dlg(true);
CString path=dlg.getFileName();
this code returns only the file name...but what i want is comple path of that file...
|
|
|
|
|
If you are using CFileDialog class you can use the CFileDialog::GetPathName .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
ooh yes...sorry i have used getPathName method instead...it was the typing mistake.... i havnt got the result by using GetPathName method
|
|
|
|
|
MahaKh wrote: i have used getPathName
If that doesn't work then you may try GetFolderPath along with GetFileName of CFileDialog .
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
Hi,
I have a program that uses a tree for navigation and if you select a node it starts computing. In order to be able to abort the computation, I wanted to show an abort dialog. However if I continue clicking on the tree, while waiting for the dialog, it is possible to get the tree into a state, that it will always jump back a node (last clicked before the dialog popped up).
It doesn't happen with every popup, it has to do with the timing of the click and the dialog.
If the tree is in that state, you can select another node, it will show it as selected as long as the mouse button is pressed, if you release it it will jump back and show the other node as selected. The focus rectangle remain on the "correct" node, also the computation starts for the correct node.
I generated a small program, with Visual Studio 2008, a single dialog with visual studio layout. And the only code I added was a timer to popup the about dialog every 2 seconds (if it is not already shown).
Even in this program I am able to reproduce it. I tried varies things, such as giving the focus back to the dockable pane with the tree in it, moving the timer handler to the treectrl, tried to peekmessage and such, but nothing works and I'm running out of ideas.
Hopefully someone here can help me.
I uploaded the code to: file factory (sorry but I don't have another option atm )
modified on Wednesday, May 6, 2009 6:06 AM
|
|
|
|
|
How do you pop up the dialog when the tree is processing? Does the processing occur in the same thread as the UI? Maybe you could deactivate the tree control while the processing is occurring so the user doesn't expect clicks on the tree to work?
__GJ__ wrote: I uploaded the code to: file factory (sorry but I don't have another option atm )
That's a 14MB zip file? You expect people to dig through 14MB+ your code without any guidance as to where your issue is?
__GJ__ wrote: sorry but I don't have another option atm
Yes you do - you can post the text of the minimal source code that exhibits this problem in a reply on this forum - and I don't mean the slightly modified VS dialog project - I mean the least amount of code that exhibits the problem - chop out anything that isn't relevant.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I set a timer in CMainFrame. In the OnTimer function it checks whether or not it should activate the dialog. I call DoModal in the same thread as the UI.
Cleared out the zip file(removed the debug directory) it now only 114kb. Code
With "no other option" i meant filefactory, since I don't have a server available. But that's besides the point, I don't really know where the problem lies, I think it has something to do with a Modal dialog interupting a message sequence from the TreeCtrl, but that's just guessing. Other than setting the timer I just used a default program setup generated by Visual Studio 2008.
It could be that it does not create the view or treectrl properly.
This is how the generated code from Visual Studio 2008 creates the View windows.
The CDockablePanes are created in the function CreateDockingWindows in CMainFrame
CString strClassView;
bNameValid = strClassView.LoadString(IDS_CLASS_VIEW);
ASSERT(bNameValid);
if (!m_wndClassView.Create(strClassView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_CLASSVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create Class View window\n");
return FALSE;
}
This leads to the onCreate of the FileView (also generated code)
int CFileView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rectDummy;
rectDummy.SetRectEmpty();
const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS;
if (!m_wndFileView.Create(dwViewStyle, rectDummy, this, 4))
{
TRACE0("Failed to create file view\n");
return -1;
}
m_FileViewImages.Create(IDB_FILE_VIEW, 16, 0, RGB(255, 0, 255));
m_wndFileView.SetImageList(&m_FileViewImages, TVSIL_NORMAL);
m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_EXPLORER);
m_wndToolBar.LoadToolBar(IDR_EXPLORER, 0, 0, TRUE );
OnChangeVisualStyle();
m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY);
m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT));
m_wndToolBar.SetOwner(this);
m_wndToolBar.SetRouteCommandsViaFrame(FALSE);
FillFileView();
AdjustLayout();
return 0;
}
The timer, onAbout does DoModal (added by me)
void CMainFrame::OnTimer(UINT_PTR nIDEvent)
{
switch(nIDEvent)
{
case IDT_MAINTIMER:
{
KillTimer(IDT_MAINTIMER);
CTreeBugTestApp* pApp = (CTreeBugTestApp*) AfxGetApp();
pApp->OnAppAbout();
SetTimer(IDT_MAINTIMER, 2000, NULL);
break;
}
}
}
The generated OnAppAbout function
void CTreeBugTestApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
|
|
|
|
|
I'm still not entirely sure what the problem is - OK, the tree-view loses focus. That's easily solved, with this (I've commented the lines I've added to your code):
void CTreeBugTestApp::OnAppAbout()
{
CWnd* pFocusWnd = CWnd::GetFocus();
CAboutDlg aboutDlg;
aboutDlg.DoModal();
if (pFocusWnd) pFocusWnd->SetFocus();
}
Any other issues?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Tried it and it didn't work.
Problem is that if you click a lot on the tree, while waiting for the dialog to pop up. And if you time it right, clicking at the exact time to the dialog popups up. It is possible to get the tree to think that the last clicked node should be displayed as selected.
In that case the tree keeps jumping back to the last clicked tree-node. Meaning you last clicked node1 in the tree before the dialog pops up, you close the dialog and click node 2. That node 2 is displayed as selected as long as your mouse button is pressed, but as soon as you release it jumps back and displays node 1 as selected. But it should display node 2 as selected!
|
|
|
|
|
I think I finally found it.
If I call SelectDropItem(NULL) in the OnNMClick, it seems to fix the problem.
|
|
|
|
|
I have program like this
#include <iostream>
using std::ios;
using std::endl;
class A : public B
{
public:
static bool abool;
static std::ostream xyz;
}
#include <iostream>
#include "header.hh"
using std::ios;
using std::endl;
bool A::abool;
std::ostream A::xyz;
Here, while compilng i get error saying that
undefined reference to A::xyz
but there is no error with A::abool ??
Can anyone explain why this error is there and how to remove it ??
Thanks.
|
|
|
|
|
Have you actually taken the snippet of your working code.
I don't see a ; after the class declaration.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I get a quite different error:
error C2512: 'std::basic_ostream<_Elem,_Traits>' : no appropriate default constructor available
That, after all, looks quite reasonable.
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
[My articles]
|
|
|
|
|
yes this is a part of my working code
and i have just pasted the part where i am having error
|
|
|
|
|
I suppose you're replying to the wrong reply...
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
[My articles]
|
|
|
|
|
I don't get your error with VC++ or gcc, either when I add a semi-colon to the end of the class definition or not. I get other errors, but not the one you've got. You're likely not posting sufficient of your code to expose the error.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
actually, above code was just a part of the actual code
and i just wanted to know how to use static variables defined in header files in .cpp files
posting actual code isn't possible as it is very long and this code is then used by another library...
so i just pasted the part where i was having error...
i found the error that ostream doesn't have any constructor that takes no parameters...
now i am guessing that code is OK but there might be some linking problems...
thanks all for your help
|
|
|
|
|
I have write a program ,which can run on local computer .but it can't access to remote ad.
this is my first question ,please help me.thank you
|
|
|
|
|
|
Becuase we are human not robot and you need to wait.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hamid. wrote: Becuase we are human not robot and you need to wait.
I am working on Hamid Version 2.0 Robot, who will watch for question coming on vc++ forum and answer it instantly....
But i don't know how to create it hand
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
ljz888666555 wrote: why no one help me?
After 3 minutes ? C'mon, this is not a chat, it is a forum.
And if you want to increase your chances of getting an answer, I suggest you read the posting guidelines at the top of this forum.
|
|
|
|
|
actually we don't understand your question, briefly describ actually what do you want?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
sorry,I have writen a progma.It can runs on service computer which have installed AD.
But ,if it runs other computer ,it can't access the service's AD.
|
|
|
|