|
I'm working in VC++6. How can i do to set the cursor in a row position of CLisCtrl? That way, if the user press down or up arroy the movement starts from the designated position. I can use the CListCtrl.EnsureVisible( iPos, TRUE) to ensure visibility but the movement starts from the begin.
Thanks a lot.
|
|
|
|
|
Try using list.SetItemState(iPos,LVIS_FOCUSED,LVIS_FOCUSED) .
See CListCtrl::SetItemState[^] for more information.
Software Zen: delete this;
|
|
|
|
|
|
You're welcome. I've used the list control a fair amount, and I know some of the things that ought to be easy can be difficult to find in the MS documentation.
Software Zen: delete this;
|
|
|
|
|
Gary Wheeler wrote: easy can be difficult to find in the MS documentation.
Humm, sometimes!
"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
|
|
|
|
|
I agree too. Examples in MS documents are so poor.
m_mylistctrl.SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED);
BOOL SetItemState(
int nItem,
UINT nState,
UINT nMask
);
But I still don't know what do these two LVIS_SELECTED mean. Should they always be the same? Anybody can tell me?
|
|
|
|
|
This approach lets you set some state bits and clear others in a single call. The nState argument contains the bits you want to set, while the nMask argument contains the bits you want to change. For example, if you call it like this:
m_mylistctrl.SetItemState(iItem,LVIS_FOCUSED,(LVIS_FOCUSED | LVIS_SELECTED)); this would set the LVIS_FOCUSED state and clear the LVIS_SELECTED state for the specified item.
Software Zen: delete this;
|
|
|
|
|
Not agree...
I have many times found no usefull help in MSDN. It depends on what you look for. Some times the explanations are too poor and the examples vanal.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
I didn't say MSDN was perfect. I just said that it was often more difficult to find things in it than it should be. The MSDN Library has been reorganized several times, often without any improvement in content.
Software Zen: delete this;
|
|
|
|
|
Sorry, then I missunderstood you.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hi,
I am having this image viewing program where I have a dialog that gets created (using DoModal) for adjusting brightness/contrast with initial values set by main frame. I would like to know how I can update the image thats being displayed on main frame whenever I change the values in the pop up dialog.
thanks in advance,
-PNT
PKNT
|
|
|
|
|
one way is to use SendMessage to send the updated values
|
|
|
|
|
or pass a pointer to the main window to the child dialog.
or use the observer/observable pattern.
|
|
|
|
|
yep got it.... the problem is I am including the header file of my child dialog in my DOC header file and when I try to define a pointer to to a doc object in my child dialog's header file by including the main frame's header file in it, it gave me error of undefined symbol error. Then i tried to include the child dialog's header file in the main frame's cpp file and now its working fine.
thanks for your replies.
PKNT
|
|
|
|
|
I've got a full screen dialog application in which i want the user to be able to drag any dialogs which pop up to any position they want on the screen but also to limit them from certain areas of the screen. I've used the following article http://www.codeproject.com/dialog/dragwindows.asp?df=100&forumid=4307&exp=0&select=1749703[^] for the dragging of the dialog (using the OnNcHitTest method). However I can't figure out how to limit where they can drag the dialog. I've though it would be a simple matter of converting the CPoint position for the mouse into screen co-ordinates and checking if it is in a forbidden region and then setting it to be outside of this region.
Any suggestions?
cheers,
Andy
|
|
|
|
|
ok, found my first mistake, was looking at the x part of the CPoint instead of the y!
I think I've figured the problem, the OnNcHitTest only seems to be called when I've released the left mouse button, so during my drag it doesn't get called. Is there anyway around this?
|
|
|
|
|
mcsherry wrote: the OnNcHitTest only seems to be called when I've released the left mouse button, so during my drag it doesn't get called
That's because the system enters a modal message loop for the duration of
the drag.
You may want to take a look at the WM_MOVING message.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi thanks for your reply, I've got the solution now, all I had to do was re-read the article I linked to in my orignal post and implement the OnLButtonDown, OnLButtonUp and OnMouseMove methods instead of the other one and do my region check in the OnMouseMove method.
Andy
|
|
|
|
|
mcsherry wrote: OnLButtonDown, OnLButtonUp and OnMouseMove methods instead of the other one and do my region check in the OnMouseMove method
Cool
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi, i have SDI app and CDialog based window, i need to scroll client area if something in window is larger than window itself. I overwrite DoDataExchange() function and add :
SetWindowPos(&wndTop, 0, 0, 800, 500, SWP_SHOWWINDOW);<br />
if(x==2){<br />
ShowScrollBar(SB_BOTH);<br />
SetScrollRange( SB_HORZ, 10, 5000);<br />
SetScrollRange( SB_VERT, 10, 5000);<br />
}<br />
But i can't scroll client area.
In previous app i use CFormView derrived window and overwrite OnUpdate() function using this code :
<br />
void CResize1View::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) <br />
{<br />
if(((m_iLiczbaBut+1)*50)> 400){<br />
SetScrollSizes(MM_TEXT, CSize(780, (m_iLiczbaBut+2)*50));<br />
}<br />
else{<br />
SetScrollSizes(MM_TEXT, CSize(780, 500));<br />
}<br />
<br />
}
It work corectly in CFormView, but this time i need the same in CDialog but i don't know how to do this. Please help.
|
|
|
|
|
Hi zarraza,
It is possible (if I recall correctly). I believe I found a sample floating around the web a few years back. The details escape me. Sorry.
Jeff
|
|
|
|
|
I seem to be pulling my hair out. Maybe because it's easier than I think and nobody seems to need help with it, but I am trying to get 2 pieces of data out of my bridge using SNMP and display them on a window.
Problem is, I can find no libraries or code projects that seem to address this in any detail. Is it that difficult?
I am an old C programmer than is getting back into prgramming and I like vc++ and am just learning it, so maybe its just me : /
Seems like there could be a function where you send it the MIB octet and get your number back:
unsigned long in GetSNMP(octect *sOctet);
Thanks
-Jay
|
|
|
|
|
Rhymhoont wrote: I like vc++ and am just learning it, so maybe its just me
So you are developing this for Windows? If so you want to look at the WMI API. There is a SNMP provider available and the API provides the Read/Write operations you seem to be asking about. According to the documentation the provider is not available on 95/98 OS.
http://www.google.com/search?hl=en&q=MSDN+WMI+%22SNMP+Provider%22&btnG=Search[^]
|
|
|
|
|
Yes it will be a Win32 app.
I'll take a look at that. Thank you.
So far I am just reading my MRTG log files for the data but, for obvious reasons, want the app itself probe the bridges for data.
I was concidering making a console based app that probes and uploads the data into SQL, and then the Win app reads it and reacts from there. This could be done with two win apps as well, with one running as a service. But in any case, I must be able to get the SNMP data. ; )
Thanks again
|
|
|
|
|
hai all,
i will narrate an example, there by convey my doubt.
in my edit box, the fifth character cannot be an alphabet.
so if the user types 1a34 and D,
i have to delete D from the string in the editchange event and replace the string 1a34 there, such that, the user can type a valid fifth character.
here the problem iam getting is, if i do like this, the cursor is placed at the starting of the string.
now is there any technique, suchthat, i can set the cursor at a required position?
thanks for the opinions.
|
|
|
|