|
If I remove the comments from this line,
//m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_NORMAL,100); an exception occurs. If I break that exception, it goes to a file called barstat.cpp
void CStatusBar::SetPaneInfo(int nIndex, UINT nID, UINT nStyle, int cxWidth)
{
ASSERT_VALID(this);
BOOL bChanged = FALSE;
AFX_STATUSPANE* pSBP = _GetPanePtr(nIndex);
pSBP->nID = nID;
if (pSBP->nStyle != nStyle)
********{
if ((pSBP->nStyle ^ nStyle) & SBPS_STRETCH)
bChanged = TRUE;
else
{
pSBP->nStyle = nStyle;
pSBP->nFlags |= SBPF_UPDATE;
SetPaneText(nIndex, pSBP->strText);
}
pSBP->nStyle = nStyle;
}
if (cxWidth != pSBP->cxText)
{
// change width of one pane -> invalidate the entire status bar
pSBP->cxText = cxWidth;
bChanged = TRUE;
}
if (bChanged)
UpdateAllPanes(TRUE, FALSE);
}
The yellow pointer appears in the line where ******** is shown. What may be the problem?
-- modified at 1:27 Monday 12th February, 2007
|
|
|
|
|
T.RATHA KRISHNAN wrote: AFX_STATUSPANE* pSBP = _GetPanePtr(nIndex);
pSBP->nID = nID;
if (pSBP->nStyle != nStyle)
It may be beacuase, pSBP is NULL. Are you sure, there are two panes present in status bar ? Have you called this function after creating status bar ?
|
|
|
|
|
Yes, There are two status bar panes. I've called SetPaneInfo function after creating the Status Bar only. The code for displaying message in the status bar pane is,
void CPerspectiveDoc::OnShowMsg(CCmdUI* pCmdUI)
{
char str1[150];
//int len = message.GetLength();
sprintf(str1, "%s",message.GetString());
CDC* pDC = m_wndStatusBar.GetDC();
pDC->SetTextAlign(TA_RIGHT);
pCmdUI->Enable(TRUE);
//m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_NORMAL,100);
pCmdUI->SetText((const char *)str1);
//m_wndStatusBar.SetPaneInfo(1, IDS_MESSAGE, SBPS_STRETCH, len);
}
Here this line,
CDC* pDC = m_wndStatusBar.GetDC();
compiles without any problem.
This line also,
pDC->SetTextAlign(TA_RIGHT);
compiles without problem. But not displaying message right aligned.
If I remove commenting from this line,
//m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_NORMAL,100);
then only that exception occurs.
|
|
|
|
|
Show the code, how you have created this status bar ?
|
|
|
|
|
The code for creating Status Bar is,
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1;
}
Here is the Indicators.
static UINT indicators[] =
{
0,// ID_SEPARATOR
IDS_MESSAGE,
ID_SHOWFPS,
};
IDS_MESSAGE is the ID of the second pane. The pane in which we display the message. ID_SHOWFPS is the ID of the First pane.
I display the message in some other class using the following code.
void CPerspectiveDoc::OnShowMsg(CCmdUI* pCmdUI)
{
char str1[150];
//int len = message.GetLength();
sprintf(str1, "%s",message.GetString());
CDC* pDC = m_wndStatusBar.GetDC();
pDC->SetTextAlign(TA_RIGHT);
pCmdUI->Enable(TRUE);
//m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_NORMAL,100);
pCmdUI->SetText((const char *)str1);
//m_wndStatusBar.SetPaneInfo(1, IDS_MESSAGE, SBPS_STRETCH, len);
}
|
|
|
|
|
T.RATHA KRISHNAN wrote: if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1;
}
I'm seeing nothing wrong with your code, its creation is succesful. May be you mail send across your sample code ay prasad.som at mail dot com.
|
|
|
|
|
Could U pls send me your correct email ID? (like this one rtr_18@yahoo.com)
|
|
|
|
|
T.RATHA KRISHNAN wrote: Could U pls send me your correct email ID?
It is correct.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If you call,
m_wndStatusBar.SetPaneInfo(0, IDS_MESSAGE, SBPS_STRETCH, len);
is program crashing?
|
|
|
|
|
T.RATHA KRISHNAN wrote: static UINT indicators[] =
{
0,// ID_SEPARATOR
IDS_MESSAGE,
ID_SHOWFPS,
};
IDS_MESSAGE is the ID of the second pane.
Do you have an entry for IDS_MESSAGE in the stringtable resource?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I think its strange that one problem persists for such a long time...
I have some questions for you.
1. Have you used "SetIndicators" function?
>> If you are not using function, your prograam will definitely crash.
2. What is the idea behind doing these operations in a DOC class?
3. Is it possible to share the code you are using to create status bars?
thanks and regards
haribabu
|
|
|
|
|
Here is the indicators array.
static UINT indicators[] =
{
0,// ID_SEPARATOR
IDS_MESSAGE,
ID_SHOWFPS,
};
The code that is used to create status bars.
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1;
}
These two codes are in the same file only(MainFrm.cpp)
|
|
|
|
|
|
T.RATHA KRISHNAN wrote: Actually my requirement is to set width of the second pane only.
Do you have to use SetPaneInfo() to do this?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
ok i would like to make a console app be able to send a command to a nother console app and have it run it,
i use dev C++ for the compiler.
|
|
|
|
|
heyhey
so, I searched everywhere and I cannot find the right answer...
I want to do a filter of my output in OpenGl. output actually means framebuffer but perhaps I have to do the operation somewhere else.
I want to subtract parts of the color, so let's say 50% red and 20% green.
I found the way of removing all the RGB parts by glColorMask(R,G,B,Alpha) but that's not exactly what I want, because it removes the whole R,G or B part!
I could use some BlendFunc I figured out but I'm not sure how to use it.
And I would need to set a certain background color for that.
I did something with that my 3d model got transparent, too, cause I need to use the alpha channel one way or the other. And I don't want that either.
Hope you got my question cause it's buggin me now for some days
zqueezy
|
|
|
|
|
Not sure exactly what you are asking, but you may want to try glPixelTransfer().
e.g.
glPixelTransferf(GL_RED_SCALE, 0.2126);
glPixelTransferf(GL_GREEN_SCALE, 0.7152);
glPixelTransferf(GL_BLUE_SCALE, 0.0722);
would convert the RGB colours to their luminance (grey scale) value.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hi all,
Following is the problem (I provided some test code):
After runing the below sample the correct item is displayd at
the top of the list control's visible area just as I want.
The problem is that if I push the VK_DOWN or VK_UP key, the next
selected item will be the first item and not item 356 or 354 as
as you would expect from this sample.
The list will automatically scroll to the first item. However if
I click on the selected item (in this example 355) and then push
the VK_DOWN or VK_UP key it will select the correct item
(in this example 356 or 354).
This is really anoying. Could anybody please give me a hint on how
to proceed. It should be easy to solve but I just can't figur it out.
// In CMyDialog.h
CListCtrl m_cListCtrl;
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// Remove styles
m_cListCtrl.ModifyStyle( LVS_ICON | LVS_LIST | LVS_REPORT | LVS_SMALLICON, 0 );
// Add styles
m_cListCtrl.ModifyStyle(0, LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS );
// Add extended styles
ListView_SetExtendedListViewStyle( m_cListCtrl.m_hWnd, LVS_EX_FULLROWSELECT );
// Header
m_cListCtrl.InsertColumn( 0, "Col 1", 0, 100 );
m_cListCtrl.InsertColumn( 1, "Col 2", 0, 100 );
// Set LVITEM structure
LVITEM lvi;
lvi.mask = LVIF_TEXT;
lvi.iSubItem = 0;
// Adding items and subitems
for ( int i=0; i<900; i++ )
{
lvi.iItem = i;
lvi.pszText = "";
m_cListCtrl.InsertItem( &lvi );
for ( int j=0; j<2; j++ )
{
CString str;
str.Format( "Col %d, Row %d", j, i );
m_cListCtrl.SetItemText( i, j, str );
}
}
return TRUE; // return TRUE unless you set the focus to a control
}
void CMyDialog::OnBnClickedButton1()
{
int nItemIndex = 355;
CRect rcTopItem;
CRect rcSelItem;
// Current top visible item
int nTopIndex = m_cListCtrl.GetTopIndex();
// Get bounding rectangle around the current top item
m_cListCtrl.GetItemRect( nTopIndex + 1, &rcTopItem, LVIR_BOUNDS );
// Get bounding rectangle around the selected item
m_cListCtrl.GetItemRect( nItemIndex, &rcSelItem, LVIR_BOUNDS );
// Compute the y distance between the two items
CSize sz( 0, rcSelItem.bottom - rcTopItem.bottom );
m_cListCtrl.Scroll( sz );
m_cListCtrl.SetItemState( nItemIndex, LVIS_SELECTED, LVIS_SELECTED|
LVIS_FOCUSED );
m_cListCtrl.EnsureVisible( nItemIndex, FALSE );
m_cListCtrl.SetFocus();
}
|
|
|
|
|
Zombie_Inc wrote: m_cListCtrl.SetItemState( nItemIndex, LVIS_SELECTED, LVIS_SELECTED|
LVIS_FOCUSED );
You are clearing the LVIS_FOCUSED flag for the item in the above code. Was that your intention?
If fixing that doesn't help...
What if you clear the previous focused/selected item before setting the newly selected/focused
item?
m_cListCtrl.SetItemState( -1, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|
LVIS_FOCUSED );
m_cListCtrl.SetItemState( nItemIndex, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|
LVIS_FOCUSED );
|
|
|
|
|
Hi Mark,
All I can say is thank you a million times!!!!!
Your first suggestion did not help but clearing the
previous selected item did the trick.
I knew there was an easy fix for it.
Thanks again.
Regards
Lars
|
|
|
|
|
Cool!
I was just going to direct you to this, although it wouldn't have helped:
How To Select a Listview Item Programmatically[^]
Anyway, I looked up the default processing for WM_LBUTTONDOWN in a listview control and it got
me thinking that maybe just because the single-select style is set doesn't mean the control clears
the previous selection if you manually select another.
Glad it worked!
Mark
|
|
|
|
|
Was the correct code
m_cListCtrl.SetItemState( -1, 0, LVIS_SELECTED|LVIS_FOCUSED );
instead of
m_cListCtrl.SetItemState( -1, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|
LVIS_FOCUSED );
??
|
|
|
|
|
Before I start building my logger class, I wouldn't mind a having a few ideas on how to create it. This is a basic outline of what I need: The file needs to be divided into sections ( OS details, Error's and program flow ). The latter two sections would need to be resizable, but the file must have a max size limit. ( I don't want end users e-mailing me 10 mb log files ). The file doesn't need to be readable, I can create a seperate utility for this.
Now I'm not very sure how to procede. I'm thinking a memory mapped file with a linked list. But a linked list is basically a pointer to a pointer which isn't very practical in a mapped file. Another way I could do it is use some sort of hash table. Divide the whole file into chunks and each entered record has it's offset stored in a known place.
I'm open to ideas on this one.
|
|
|
|
|
How about two linked lists of file offsets - one for error entries, one for program flow entries.
Store a offset-first and offset-current for each list in a header struct at the beginning of (or
a known place) in the file.
To add a new entry:
1) get the offset-current
2) append the entry to the end of the file (noting it's offset)
3) move to the offset-current entry and update it's next-offset to the new entry offset
4) set the offset-current to the new entry's offset
4a) if it's the first entry then set offset-first as well
5) flush the file buffers to ensure the disk image is current in case of crashes.
Mark
|
|
|
|
|
It's probably the best way to approach the problem. The only trouble is dealing with the items when the file reaches it's max size. Obviously the oldest entries should be removed, but going from the begininning to the end is where the problem lies. Each entry would have to be a fixed size. So lets make them 256 bytes each, but what happens when a critical error occurs and it needs 600 bytes to log the error?
So I'm thinking of a structure similar to a FAT table. IE have allocation slots within the file, but the problem here is how to index them.
|
|
|
|
|