|
CButton:Create() would be a great start
Just call this function inside a for loop or something and space the buttons accordingly. You'll probably have to handle button clicks inside OnCommand() though instead of MFC message map function.
Cheers
I'm drinking triples, seeing double and acting single
|
|
|
|
|
Hi,
In my application, MDI, I have to read an output file in one of the dialog boxes.
According to the output file, lets say 6 is read in the file.
I then have to make 6 Buttons in that Dialog box.
the number 6 could change, so I would like to know how to make it dynamic.
Any ideas?
Ehsan Behboudi
|
|
|
|
|
Just use a std::vector of CButtons.
std::vector<CButton> m_Buttons;
ifstream inFile;
char buff[1024] = {0};
CString szBuff;
inFile.open("YourFile.txt");
while !inFile.eof())
{
inFile.getline(buff, sizeof(buff), chDelim);
szBuff = buff;
m_Buttons.push_back(CButton());
if(!m_Buttons.back().Create(static_cast<const char*>(szBuff), STYLEFLAGS, rectforbutton, this, uiSomeID))
TRACE("Error creating button");
m_Buttons.back().ShowWindow(SW_SHOW);
}
inFile.close();
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
how to add "find text" feature in CHtmlView to find text in its html content?
includeh10
|
|
|
|
|
I want to use the same dialog resource for three different tabs in a property sheet because each tab has the same appearance, e.g. one list control. Kind of data loaded to the list will be based on which tab is selected. Can this be done?
Eilzabeth
|
|
|
|
|
are you asking how to dynamically set the text on the property page tabs? if so, see below code.
void CMYPropertySheet::SetTabNames( const CString& page1Name, const CString& page2Name, const CString& page3Name )
{
TC_ITEM tcItem;
tcItem.mask = TCIF_TEXT;
tcItem.pszText = (LPTSTR)((LPCTSTR)page1Name);
GetTabControl()->SetItem( 0, &tcItem );
tcItem.pszText = (LPTSTR)((LPCTSTR)page2Name);
GetTabControl()->SetItem( 1, &tcItem );
tcItem.pszText = (LPTSTR)((LPCTSTR)page3Name);
GetTabControl()->SetItem( 2, &tcItem );
}
|
|
|
|
|
This is one of the constructors of CPropertyPage:
CPropertyPage( UINT nIDTemplate, UINT nIDCaption = 0 )
Simply pass the relevant string identifier as the second parameter
|
|
|
|
|
I tried Add(&m_testpage("test")) at the property sheet class's constructor, but the compiler did not like it. It says term does not evaluate to a function. May be you can tell me where to fix. I have this in the property page:
IMPLEMENT_DYNCREATE(CInboxPropPage, CPropertyPage)
CInboxPropPage::CInboxPropPage() : CPropertyPage(CInboxPropPage::IDD)
{
//{{AFX_DATA_INIT(CInboxPropPage)
//}}AFX_DATA_INIT
}
Eilzabeth
|
|
|
|
|
ElizabethC wrote:
but the compiler did not like it
Yeah the buggers have no sense of humour!
First create your string in the .rc file (Call it IDS_MYSTRING "String")
in InboxPropPage.h, change your contructor to be
CInboxPropPage(UINT nCaptionId=0);
in InboxPropPage.cpp, change your contructor to be
CInboxPropPage::CInboxPropPage(UINT nCaptionId) : CPropertyPage(CInboxPropPage::IDD,nCaptionId)
When you create the sheet with its pages, write
CInboxPopPage pagInbox(IDS_MYSTRING);
and you should be in business!
Good luck!
|
|
|
|
|
I added the contructor and tried to compile the code, but getting another error message:
error C2668: 'CInboxPropPage::CInboxPropPage' : ambiguous call to overloaded function
It was complaining on the IMPLEMENT_DYNCREATE line:
IMPLEMENT_DYNCREATE(CInboxPropPage, CPropertyPage)
CInboxPropPage::CInboxPropPage() : CPropertyPage(CInboxPropPage::IDD)
{
//{{AFX_DATA_INIT(CInboxPropPage)
m_message_flag = "0";
//}}AFX_DATA_INIT
}
CInboxPropPage::CInboxPropPage(UINT nIDCaption) : CPropertyPage(CInboxPropPage::IDD, nIDCaption)
{
//{{AFX_DATA_INIT(CInboxPropPage)
//}}AFX_DATA_INIT
}
Eilzabeth
|
|
|
|
|
Do not add the constructor, replace it...
|
|
|
|
|
Thank you. It works.
Eilzabeth
|
|
|
|
|
Cool... I started to doubt! By the way, your sig has a spelling mistake...
|
|
|
|
|
Got it fixed. Just realized that I need to update my profile.
Elizabeth
|
|
|
|
|
Is it possible to force a particular font size eg. 96 dpi (regardless of what the user has in their windows settings) for an application. I have some dialogs which are hardcoded to a specific size and users with larger fonts don't have a correct display. I am using Win32.
|
|
|
|
|
In general, no. The desktop font size is a system-wide parameter. You are better off designing your dialogs to work correctly with the 'large fonts' setting (the simplest solution) or adding code to have the dialogs automatically resize/reposition their controls (complicated, but the only way to guarantee similar proportions regardless of the desktop setting).
Software Zen: delete this;
|
|
|
|
|
Hi,
I'm Massimo an Italian webmaster wiht a free host service.
My server is Win2000 Server with IIS 5.0 and
I would want to insert in every sub-domains of my network one banner of publicity....
I have found the function:
IIS Manager --> Select site --> Properties --> [Document tab] --> Enable document footer
that it inserts the html document in evry page of selece site..
It would be necessary to me a easy isapi filter that it inserted the html document in header of evry page of the select site...
Can you help me, please ?
Bye
Massimo
Webmaster veniceflashing.net; venicehost.it
|
|
|
|
|
How can I add to the right click menu of the IE my application?
I successed to do it with an htm file but not to an exe app. like the option with the Excel.
|
|
|
|
|
Which context menu are you interested in adding to?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
For instance, I want to send the URL of an image to my application.
I found that I can enter a key with my application path to the registry: HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt and there to add DWORD value 'Contexts' with the context I need( to image I think is 22), I successed to send it to a htm file but not to win32 app.
|
|
|
|
|
Hi, I've created a unicode application, that should display (in a static control) some international text of unknown origin (any language).
I understand that I have to choose a font for my control, and I was wondering what font I should select. I've heard Arial Unicode MS is pretty good, but it's still very much behind the latest Unicode standard (which is 4.0). Do you know which font is the best and most comprehensive unicode-font out there to date? Do you have any links to such fonts? I've tried looking up fonts on the web, and I can't seem to find anything reasonable - only some no-namers that I don't really want to use for a commercial application...
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
I use Microsoft Sans Serif if that's of any help!
|
|
|
|
|
Unfortunately, it's not covering most of the Unicode standard. It only represents 1403 characters. The Unicode standard, as it is todays, holds tens of thousands of characters.
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
Is possible to create a toolbar or dialogue bar with having icons justificated on both left and right? I is want to have differents sets of icons and am wanting to separates them by putting on left or on the right.
Thanks with muchly
|
|
|
|
|
When you want to justify to the right you need to use the Indent function
CToolbarCtrl::SetIndent
Best Regards
Carlos Antollini.
Pi Five[^]Creator
|
|
|
|