|
Check whether value is already in the CB.
Greetings from Germany
|
|
|
|
|
Hi,
Use combox->FindStringExact(...) Api of the CB. if it is -1 then add the string if it gives any nuber greter than 0 then there is a string.
Good Luck.
Uday kiran
|
|
|
|
|
I think that you don't understand my question
i'll give you an exemple
my combo 0
1
2
3
when I select a value "0" for example and press the button ok it'll be added to the list. I want that when I select this value again it 'll not be added to the listBox because it's already exists.
i hope that my explanation is more clear
thank's
|
|
|
|
|
what's the problem
Uday kiran
|
|
|
|
|
I don't want to have in my listBox for example
0
1
0
0
you understand me ? the value 0 must figure one's
|
|
|
|
|
hi,
I told na use FistStringExact(...) api which detects the Duplicate Values in the ListBox.
//Code.........
int i = -1;
i = cb->FindStringExact("one"); // one is a String value you want to insert.
if(i == -1)
{
Cb->AddString("one");
}
else
{
MessageBox("Already Exist in the List");
}
// end of the Code
Whats the Problem.
Uday kiran
|
|
|
|
|
thank you this is what I want
|
|
|
|
|
zizzzz wrote: ...if i insert a value the second time he must don't accept it.
First check to make sure the listbox (not the combobox) does not already contain the item. If it does not, call AddString() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
yes David I did it and it's working like I want
thank's for you and for uday kiran janaswamy
|
|
|
|
|
Dear all
for one application I need to know which DMA and interrupt line is used by Paraller port I computer.
Do you have any idea about this.
Regards
Mahdi
|
|
|
|
|
I have the following code in my app..
CMultiDocTemplate* pDocTemplate2;<br />
pDocTemplate2 = new CMultiDocTemplate(<br />
IDR_TTOOLTYPE,<br />
RUNTIME_CLASS(CReportDoc),<br />
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CReportView));<br />
pDocTemplate2->SetContainerInfo(IDR_TTOOLTYPE_CNTR_IP);<br />
AddDocTemplate(pDocTemplate2);<br />
<br />
CMultiDocTemplate* pDocTemplate1;<br />
pDocTemplate1 = new CMultiDocTemplate(<br />
IDR_TTOOLTYPE,<br />
RUNTIME_CLASS(CGraphDoc),<br />
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CGraphFormView));<br />
pDocTemplate1->SetContainerInfo(IDR_TTOOLTYPE_CNTR_IP);<br />
AddDocTemplate(pDocTemplate1);<br />
<br />
CMultiDocTemplate* pDocTemplate;<br />
pDocTemplate = new CMultiDocTemplate(<br />
IDR_TTOOLTYPE,<br />
RUNTIME_CLASS(CTToolDoc),<br />
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CTToolView));<br />
pDocTemplate->SetContainerInfo(IDR_TTOOLTYPE_CNTR_IP);<br />
AddDocTemplate(pDocTemplate);<br />
CMainFrame* pMainFrame = new CMainFrame;<br />
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))<br />
return FALSE;<br />
m_pMainWnd = pMainFrame;
can ne one help me in getting buttons to control focusing of these views????
|
|
|
|
|
keyurbhatnagar wrote: can ne one help me in getting buttons to control focusing of these views????
The easiest way is to define your own WM_xxx message(s) and have the view's frame windows
send/post them to the main frame window or whichever window "contains" all the views.
If you have a more specific example of how you want to control focus then maybe I can post sample
code if you need it.
Mark
|
|
|
|
|
I want to make buttons on toolbar labeled 1,2&3 and use them to view these frames jst like the file list in window menu tab is used, it shows the windows that are opened and when u click on anyone it is focused and displayed on top. My application has only these 3 frames and no new document is to be made.
If you can give some sample code it would be great,
Thank you
|
|
|
|
|
I'm assuming you are using Doc/View MDI.
The first created MDI child window has id == AFX_IDM_FIRST_MDICHILD, second is
AFX_IDM_FIRST_MDICHILD+1, etc.
So, with only 3 child frames...
ON_COMMAND(ID_MYBUTTON1, OnButton1)
ON_COMMAND(ID_MYBUTTON2, OnButton2)
ON_COMMAND(ID_MYBUTTON3, OnButton3)
...
void CMainFrame::OnButton1()
{
CWnd *pWnd = GetDescendantWindow(AFX_IDM_FIRST_MDICHILD);
if (pWnd)
MDIActivate(pWnd);
}
void CMainFrame::OnButton2()
{
CWnd *pWnd = GetDescendantWindow(AFX_IDM_FIRST_MDICHILD + 1);
if (pWnd)
MDIActivate(pWnd);
}
void CMainFrame::OnButton3()
{
CWnd *pWnd = GetDescendantWindow(AFX_IDM_FIRST_MDICHILD + 2);
if (pWnd)
MDIActivate(pWnd);
}
|
|
|
|
|
Thnkx Man you have helped me a lot, actually i am a fresher only one week of exp so did'nt had the knowledge. You have to help me further as you did today
thanx once again....
|
|
|
|
|
Hi.
There is only one control in a dialog thats the Edit control. This is set as Multilined and read only. My problem is that whenever this dialog is hown the I beam cursor appears when the mouse is over the edit control.
I dont want this to happen as well the focus shouldn't be on the edit control.
Why i want this is because it should appear like a static control but with scrol bars.
Sunil
|
|
|
|
|
hi,
Use EditControl->SetFocus(-1);
May this solution may solve your problem.
Uday kiran
|
|
|
|
|
am using visual studio 2003.. so SetFocus doesnt take any parameters..
any other suggestion
Sunil
|
|
|
|
|
You can override CEdit::OnSetCursor(...) on the edit control to prevent the I-Beam cursor from being used and leave it as an arrow cursor.
You can override CEdit::OnSetFocus(...) to cause focus to automatically go to the next control - get the next control in the Z-Order and call SetFocus() on it (do not go to the previous control, otherwise tabbing through controls will not work correctly).
Note that if the user cannot focus the control, they might not be able to use the scrollbars.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hmmm.. ya that i do know..
ok is there a method to display text in a static control with a scroll bar.. or get to know the rect size needed to display the static text. i.e. once no. of chars in static text will be 100, but the next time the no. chars in static text will be 300.. so how do i change the size of rect by manipulation.
thats y i needed a edit control with a scroll bar without showing the I beam cursor when the cursor is over the edit control. I hope u got my problem now. I am not supposed to have any separate class for this purpose. And there is only one control in this dialog. So no point in setting the focus to something else.
Sunil
|
|
|
|
|
Hi.
I want to move a picture control withouth redrawing the whole window. I've searched on how to do it and i've seen several techniques, but i think that the easiest for me is by invalidating the rectangle i want to update.
So, i do something like this:
CRect rect1,rect2(200,200,300,300);
m_picture.GetWindowRect(rect1);
m_picture.MoveWindow(rect2,FALSE);
InvalidateRect(rect1);
InvalidateRect(rect2);
Where m_picture is my picture control. It seems that it redraws the new position, but it doesn't erase the old one (so, there are two pictures in the window). Of course, invalidating the whole window works, but i just want to update that zone.
I've tried using ClientToScreen and ScreenToClient, in case the coordinates were wrong, but with no success.
Somebody can help me?
Thanks in advance,
Rad.
|
|
|
|
|
Is CRectTracker Class helpfuls?
|
|
|
|
|
I've tried to use it, but i don't really need it (i just want to do a small animation, and i don't want to spend too much lines of code on it).
And, in the end, the problem is still the same, how to update the zone (how to invalidate that rect).
|
|
|
|
|
I am presuming you used ScerenToClient relative to the PARENT window, and not the picuture window?
This really should work, I think you still have a bug in your coordinates to the InvalidateRect.
Also, I think InvalidateRect on the child window's new position is redundant, as the MoveWindow already invalidates the destination for you, assuming you allowed the paint to occur:
If the bRepaint parameter is TRUE, the system sends the WM_PAINT message to the window procedure immediately after moving the window (that is, the MoveWindow function calls the UpdateWindow function). If bRepaint is FALSE, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
Hi all
I want to get HBITMAP from JPEG/JPG Resource in MFC/ATL/Win32 using IStream.I don't want to use IPicture or IPicDisp interface since they use Picture Control.
Any links or Code snippet would do fine ..
Thanx in Advance
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|