|
Hi,
You are mixing the control style, must have PBS_MARQUEE , and it's state.
Set the control style either in your DIALOG resource descriptor:
CONTROL "",IDC_PROGRESS, "msctls_progress32", PBS_MARQUEE | WS_BORDER, 23, 38, 80, 14
or in your OnInitDialog() handler:
LRESULT OnInitDialog(UINT , WPARAM , LPARAM , BOOL& )
{
CProgressBarCtrl(GetDlgItem(IDC_PROGRESS)).ModifyStyle(0, PBS_MARQUEE);
return TRUE;
}
and in your OnOK() handler switch the moving state, for instance:
LRESULT OnOK(WORD , WORD , HWND , BOOL& )
{
static bool bAnimated = false;
CProgressBarCtrl(GetDlgItem(IDC_PROGRESS)).SetMarquee(bAnimated = !bAnimated);
return 0;
}
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Sorry, not working
I already try all variants, what I can imagine - progress bar marquee definition in resource file, using WTL classes, windows messages, but nothing works.
There latest code, but progress bar still dead
LRESULT CDlgMain::OnInitDialog(UINT , WPARAM , LPARAM , BOOL& )
{
CenterWindow();
CProgressBarCtrl(GetDlgItem(IDC_PROGRESS)).ModifyStyle(0, PBS_MARQUEE);
return TRUE;
}
LRESULT CDlgMain::OnClose(UINT , WPARAM , LPARAM , BOOL& )
{
EndDialog(0);
return TRUE;
}
LRESULT CDlgMain::OnOK(WORD , WORD wID, HWND , BOOL& )
{
static bool bAnimated = false;
CProgressBarCtrl(GetDlgItem(IDC_PROGRESS)).SetMarquee(bAnimated = !bAnimated);
return TRUE;
}
IDD_DIALOG DIALOGEX 0, 0, 331, 44
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,137,23,50,14
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_MARQUEE | WS_BORDER,7,7,317,14
END
karuuzo
|
|
|
|
|
Hi,
karuuzo wrote: Sorry, not working
What does that mean?
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Nothing shows on the progress bar. I get only this and nothing else.
karuuzo
|
|
|
|
|
I uploaded a working sample at MarqueeTest.zip (6.2 KB)
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
I try on another computer, yes - it works, but on my - no
Looks-like there are problem with my computer. I using Crystal Clear visual theme, may be this is a problem?
Thanks for all, I try do something my self.
karuuzo
|
|
|
|
|
karuuzo wrote: Looks-like there are problem with my computer. I using Crystal Clear visual theme, may be this is a problem?
Sure it's not a WTL or Windows problem
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
In your original post you showed the following line of code:
::SendMessage(GetDlgItem (IDC_PROGRESS), PBM_SETMARQUEE, (WPARAM) 1, (LPARAM) 100);
so I presume your SetMarquee() method does something similar. The LPARAM value in this call affects the speed of the marquee display: the higher the value the slower the marquee. Try setting it to zero for the default behaviour.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
CProgressBarCtrl::SetMarquee from atlctrls.h (WTL):
BOOL SetMarquee(BOOL bMarquee, UINT uUpdateTime = 0U)
{
ATLASSERT(::IsWindow(m_hWnd));
return (BOOL)::SendMessage(m_hWnd, PBM_SETMARQUEE, (WPARAM)bMarquee, (LPARAM)uUpdateTime);
}
Default is 0L
karuuzo
|
|
|
|
|
So, is it working yet or not?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Yes. I change Windows theme to "Windows XP style" and progress bar start working.
karuuzo
|
|
|
|
|
Guys,
Iam a Fresher looking to build a project on my own as a open source. I want some tools informations which are like ProcessMonitor kind of, can any one let me know about the more tools available in C++/VC++.. Thanks in Advance.
Iam almost trying for microsoft Internship Please help me .... Please..
|
|
|
|
|
There are a couple of tools that hang out in the Back Room...
L u n a t i c F r i n g e
|
|
|
|
|
Get a copy of whole tomato visual assist, it is worth if you're on C++.
|
|
|
|
|
I'm trying to create a pop up list box to display some drawing line styles which are stored in an XML file. I want to display the line and then the name of the style (i.e., the items have strings).
So I derived a class from CListBox, added in some sizing code and the relevant DrawItem function, and dynamically CreateEx'd this to popup off a button in my test dialog app.
However, I'm not getting any owner-draw messages to my popup - it's blank! If I take off the LBS_OWNERDRAWFIXED|LBS_HASSTRINGS style the popup is correctly populated with the style name strings. I added an owner-draw list box to the dialog and re-classified it to use my listbox class, and barring some item sizing issues it draws the items the way I want them drawn.
So what am I not appreciating about the dynamically created version? Where are is WM_DRAWITEM messages going?
Cheers!
|
|
|
|
|
I can sort of make this work, by putting the owner-draw list box 'full-screen' on a borderless dialog (ick!) and then positioning that. But then I run into problems dismissing the dialog when the user clicks off it, and sorting out where the messages go. It would be nicer and neater if the dynamic way worked...
|
|
|
|
|
Hi,
I need to customize a CMFCPropertyGrid such that be able to display a simple button inside.
when user selects given grid, user can press button inside and then a dialog box will be displayed!
exactly like Folder dialog box.
how can i do this?
best regards
|
|
|
|
|
Can you pls help to How to associate CMap key value to CComboBox MFC
Thanks in advance.
|
|
|
|
|
its not possible to store CComboBox objects into CMap or CList since copy constructor for CComboBox is not available. However you may do it as,
CMap<int, int, CComboBox*, CComboBox*> m_map;
sample to store data
CComboBox *pBox = new CComboBox();
CRect rc(0, 0, 100, 50);
UINT nId = 100;
pBox->Create(SW_HIDE, rc, this, nId);
m_map[m_id] = pBox;
modified on Monday, September 27, 2010 11:24 PM
|
|
|
|
|
May be I did not put my question correctly.
let me put it like this.... I have a CMap
CMap<CString,LPCSTR,CString,CString&> map;
with <key1, value1="">,<key2, Value2>......
I have a combo box cmb, now I want to do some thing like
for(int j=0;j<map.GetCount();j++)
{
cmb.AddString(map[i]);
}
and now the combo should contina key1, key2.key3......
|
|
|
|
|
can't u do like
POSITION pos = map.GetStartPosition();
CString csKey, csValue;
while(pos)
{
map.GetNextAssoc(pos, csKey, csValue);
cmb.AddString(csKey);
}
|
|
|
|
|
I worked, thank you.... but was more worried about the the key value that need to be passed.
But passing the dummy key value as per ur advice worked.
Thanks
|
|
|
|
|
if you don't need values, i mean only keys, why don't you use classes like CStringArray or CList instead of CMap for that purpose?
Have a look at CComboBox::SetItemData() and GetItemData(), using which u can map a value (which can be an index or pointer to a structure or anything) to each item added to combo box.
|
|
|
|
|
Well I mean, I dont need values to fill the combo. later in business logic I need to pick the associated value on SelectCombo depending on value selected, so i need a map
|
|
|
|
|
Ya I got your point, I am using as below
// setting
while( pos )
{
appConfig.m_map.GetNextAssoc(pos, strKey, strValue);
cmb.AddString(strKey);
appConfig.m_map.Lookup( strKey, strValue );
cmb.SetItemData(iCount,(DWORD)(LPCTSTR)strValue );
iCount++;
}
temp = cmb.GetItemData( index );
CString str= (CString *) temp;
but I was unable to get the stored vaule, getting 0 in temp. can you please help me
|
|
|
|
|