Re: Stand-alone C++ programming language?
The express editions cannot use MFC?
Yes. I believe the MFC components only come with the paid versions.
Does that mean I will not be
able to get my Visual C++ NET 2003 macro recorder project to work
with the express edition?
From what you mentioned about your project, I don't think you'd gain
much benefit from moving it to a newer toolset. If you had plans to
make use of newer C++ standards facilities, then such a move may be
worthwhile, but if you're happy with what you have, why change?
Dave
nSb4bofQ8iLDGAfew2
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1;
Trident/4.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152;
.NET CLR 3.5.30729),gzip(gfe)
X-Old-Xref: news.tornevall.net microsoft.public.vc.mfc:9539
On 7 Dez., 16:31, Joseph M. Newcomer <newco...@flounder.com> wrote:
See below...
On Tue, 7 Dec 2010 01:27:26 -0800 (PST), mfc <mfcp...@googlemail.com> wro=
te:
On 7 Dez., 03:30, Joseph M. Newcomer <newco...@flounder.com> wrote:
See below...
On Mon, 6 Dec 2010 14:39:32 -0800 (PST), mfc <mfcp...@googlemail.com> =
wrote:
On 6 Dez., 16:53, mfc <mfcp...@googlemail.com> wrote:
On 5 Dez., 20:29, Joseph M. Newcomer <newco...@flounder.com> wrote:
See below...
****
What I would do is invent a code, such as CITB_CHANGED, and use a=
n ON_CONTROL handler to
handle this notification in the parent. The child button would do
GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlId(), C=
ITB_CHANGED),
(LPARAM)m_hWnd);
then I would have, in the parent's message map,
ON_CONTROL(CIBT_CHANGED, IDC_WHATEVER_BUTTON, OnWhateverChanged)
void CMyDialog::OnWhateverChanged()
{
updateaControls();
}
****
In the child button class you specifiy the id (GetDlgCtrlId = whi=
ch
child button is affected by this change) but in the parent class
(dialog class) this information is not further used? Or did I miss
something?
Is there a better solution than this:
1) including all depending button controls to this call in the
OnInitDialog() (sometimes up to six other controls affected by t=
he
spcific button)
m_Button1.SetParams(&m_StatCtrl, CImageTextButton::INCREASE, min=
value,
maxvalue, &m_Button2, &m_Button3);
How can I add these controls to one member-variable of the butto=
n
class? - using a clist (m_list.Add(m_Button2) and so on.... ?
****
Key here is how you encode it. I don't think there is a better wa=
y than having the
SetParams method (or some variant) for each button, but I might c=
onsider, if I have a lot
of buttons, having something of the form:
static const struct {
CImageTextButton * ctl,
CStatic * target,
CImageTextButton::Direction dir,
int minvalue,
int maxvalue} Buttons[] = {
{&mIncreaseSomeValue, &m_SomeControl, CImageTextButton::INCREASE,=
0, 1 },
{&m_OtherControl, CImageTextButton::DECREASE, 0, 1 },
{NULL, 0, 0, 0} // EOT
};
Could you tell me how you will declare / define this static struct in
the dialog class (so that this struct will be known in some other
methods in this dialog too)? I like the approach using a table / arra=
y
(Button[]) without knowing the size of the array at startup. So that
I can add as many buttons as I like.
****
Because it is a static struct, declared at the global scope level in t=
his compilation
unit, it is known to all methods in the compilation unit. =EF=BF=BDSo =
nothing special needs to be
done. =EF=BF=BD It is visible. =EF=BF=BDYou could also define it as a =
static member of your class, and the
syntax change is minor, and the effect is the same. =EF=BF=BDSo you co=
uld say
class CMyDialog : public CDialog {
=EF=BF=BD =EF=BF=BD =EF=BF=BDprotected:
=EF=BF=BD =EF=BF=BD =EF=BF=BD =EF=BF=BD typedef struct {
=EF=BF=BD =EF=BF=BD =EF=BF=BD =EF=BF=BD ...stuff
=EF=BF=BD =EF=BF=BD =EF=BF=BD =EF=BF=BD } BUTTON_TABLE;
=EF=BF=BD =EF=BF=BD =EF=BF=BD =EF=BF=BD static const BUTTON_TABLE Butt=
ons[];
...
};
in the .cpp file:
static const CMyDialog::BUTTON_TABLE Buttons[] = { ... };
****
Is it better to install this struct within the dialog class or should
I use another headerfile which will be included in all dialog-classes
using this struct? And how can I use your initialization in these
classes?
****
In general, you will only need this in the one dialog class, which is =
what I was assuming
in the above example code. =EF=BF=BDNow, if you want to use this table=
in other dialog classes to
build other button tables for other dialogs, you would put this typede=
f in another header
file. =EF=BF=BDYou would then include it in other dialog compilations.=
Note the declaration
=EF=BF=BD =EF=BF=BD =EF=BF=BD =EF=BF=BD static const BUTTON_TABLE Butt=
ons;
would remain the same, but instead of putting the typedef right ahead =
of it, you would
move it to the separate header file.
****
=EF=BF=BD =EF=BF=BD Buttons[] = {
=EF=BF=BD =EF=BF=BD{&mIncreaseSomeValue, &m_SomeControl, CImageTextB=
utton::INCREASE,
0, 1 },
=EF=BF=BD =EF=BF=BD{&m_OtherControl, CImageTextButton::DECREASE, 0, =
1 },
=EF=BF=BD =EF=BF=BD{NULL, 0, 0, 0} // EOT
=EF=BF=BD};
****
Note that using the sentinel to mark the end is convenient, particular=
ly if the function
doesn't have access to the definition. =EF=BF=BDIf you want to use the=
length of the struct, leave
the NULL terminator from the description and use _countof.
What I would do if I needed this in several places is create a separat=
e class which has an
AddButtons method; then I could do something like
=EF=BF=BD =EF=BF=BD =EF=BF=BD =EF=BF=BD Buttons.AddButtons();
or, if I needed the dialog reference,
=EF=BF=BD =EF=BF=BD =EF=BF=BD =EF=BF=BD Buttons.AddButtons(this);
Note that you can refactor this code in as many ways as you want. =EF=
=BF=BDIt's Just Code.
****
The problem is that if I install the typedef struct as protected in
the same class, I`ve no access to this typedef in my static c++
declaration (cpp file) as well as if I try to add some class variables
to the struct in the cpp.
class CMyDialog : public CDialog
{
protected:
typedef struct {
...stuff
} BUTTON_TABLE;
static const BUTTON_TABLE Buttons[];
/* my specific controls in this dialog */
CStaticField m_Field;
CImageButton m_Btn;
};
in the .cpp file:
static const CMyDialog::BUTTON_TABLE Buttons[] = {{&m_Btn,
&m_Field, ....}}; //<- no access to class variables ;
****
My error; that should have been
const CMyDialog::BUTTON_TABLE CMyDialog::Buttons[] = ...;
const CMyDialog::BUTTON_TABLE CMyDialog::Buttons[]= {{5,
&m_BtnRefreshL}, {6, &m_BtnRefreshR}};
error message: "a nonstatic member reference must be relative to a
specific object"
The problem is that m_BtnRefreshL, m_BtnRefreshR are members (derrived
from the cbutton class | names of the buttons in the dialog) of the
CMyDialog class.
So maybe the solution with the additional class is required to get it
working?
class CMyBtnStruct
{
public:
typedef struct {
...stuff
} BUTTON_TABLE;
void AddButtons(LPVOID ptr)
{
for(int i=0; Buttons[i].ctrl != NULL; i++)
{
How will I get the Buttons[i].ctrl to this class?
}
}
};
Where will you install the typedef struct - in the CMyDialog class or
in a separate headerfile which will be included in each dialog using
the BUTTON_TABLE?
class CMyDialog
{
protected:
CMyBtnStruct m_BtnStructMember;
}
void CMyDialog::OnInitDialog()
{
BtnStructMember.AddButtons(this);
}
****
But it's JUST SYNTAX! Note that AddButtons is a non-static member of C=
BtnStruct, and you
need a CBtnStruct member to invoke it. Now, had you declared it 'stati=
c' you could have
written
CBtnStruct::AddButtons(this);
and it would have compiled. You have to pay attention to the fine poin=
ts of syntax (which
I failed to do in the original message!)
=
joe
****
but could I use this approach when I use some member-variables in the
BUTTON_TABLE?
best regards
Hans
X-Hamster-Info: Score=0 ScoreLoad=0 ScoreSave=0 Received 101117143953
Xref: localhost comp.os.ms-windows.programmer.tools.mfc:66 microsoft.public.vc.mfc:10271
Path: news.ett.com.ua!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!198.186.194.249.MISMATCH!news-out.readnews.com!transit3.readnews.com!postnews.google.com!y31g2000vbt.googlegroups.com!not-for-mail
From: Leo <jchliustuff@gmail.com>
Newsgroups: microsoft.public.vc.mfc,comp.os.ms-windows.programmer.tools.mfc,microsoft.public.vstudio.development
Subject: Checkboxes not working with CListCtrl tile view
Date: Tue, 16 Nov 2010 21:23:21 -0800 (PST)
Organization: http://groups.google.com
Lines: 45
Message-ID: <71e0616c-32ce-4aea-bc9f-a1446847759d@y31g2000vbt.googlegroups.com>
NNTP-Posting-Host: 198.102.62.250
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1289971401 30932 127.0.0.1 (17 Nov 2010 05:23:21 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 17 Nov 2010 05:23:21 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: y31g2000vbt.googlegroups.com; posting-host=198.102.62.250; posting-account=rHNH5QoAAAA5m_IOObfZ_t2JEOQhwiqq
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1;
Trident/4.0; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 2.0.50727; .NET CLR
3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe)
X-Old-Xref: news.ett.com.ua microsoft.public.vc.mfc:33594 comp.os.ms-windows.programmer.tools.mfc:117 microsoft.public.vstudio.development:1082
I need to create a tile view using CListCtrl with checkbox for each
item. I got two issues:
1) The checkboxes are not reponsive (if I don't use tile view,
everything is fine);
2) The whole item got selected / focus when I check the checkbox (I
want it work just like the regular checkboxes --- the item itself not
highlighted / focused).
The following is my source code:
DWORD exStyle = m_listCtrl.GetExtendedStyle();
m_ listCtrl.SetExtendedStyle(exStyle | LVS_EX_CHECKBOXES |
LVS_EX_LABELTIP);
// Title info
LVTILEVIEWINFO tvi = {0};
tvi.cbSize = sizeof(tvi);
tvi.dwMask = LVTVIM_COLUMNS;
tvi.cLines = 0;
m_ listCtrl.SetTileViewInfo(&tvi);
m_ listCtrl.DeleteAllItems();
int item = 0;
// Inset list items
String capName;
bool bEnabled = false;
int count = 0;
HashPosition pos = m_capsHash.GetStartPosition();
while (!pos.IsNil())
{
m_capsHash.GetNextAssoc(pos, capName, bEnabled);
count = m_ listCtrl.GetItemCount();
item = m_ listCtrl.InsertItem(count, capName);
ListView_SetCheckState(m_ listCtrl.m_hWnd, item, bEnabled);
}
m_ listCtrl.SetView(LV_VIEW_TILE);
Any idea? Thanks in advance=85
Leo