alright, here's function
. . on_command (id_color_red, oncolor) on_command (id_color_green, oncolor) on_command (id_color_blue, oncolor) . . . void cmainwindow::oncolor () { uint nid = (uint) loword (getcurrentmessage ()->wparam); m_ncurrentcolor = nid _ id_color_red; }
so, in here loword of wparam of currentmessage supposed contain message's id, that's okay, m_ncurrentcolor = nid _ id_color_red; means? m_ncurrentcolor can 0,1, or 2 red, green, or blue respectively...
first convert message's id uint in first statement, trying in second 1 m_ncurrentcolor = nid _ id_color_red?
can please explain?
i have no idea that code does. because m_ncurrentcolor = nid _ id_color_red
won't compile. have underscore (_
) between nid
, id_color_red
. doesn't mean compiler. did mean type minus sign (-
), instead?
more generally, on_command
macro used process wm_command
messages. macro takes 2 parameters:
id
, command idmemberfxn
, name of message-hander function command mapped
it looks you've got set up. 3 command ids (red, green, , blue) being handled same oncolor
function.
let's @ documentation wm_command
message. says meaning of wparam
, lparam
parameters depends on source of message. have different meanings depending on whether user selected item menu, typed accelerator keystroke, or control sending notification message parent window.
i can't tell question of id_color_red
(and brethren) correspond to.
doesn't matter. either way, looks code attempting set member variable (m_ncurrentcolor
) keeps track of color selected user, based on id of item sent last notification. if assume that's minus sign, things start come focus little bit:
what code doing getting id of item that's sending message (nid
), , subtracting first value in set (id_color_red
). means if nid
= id_color_red
m_ncurrentcolor
0.
if values of id_color_red
, id_color_green
, , id_color_blue
sequential (and big if, reason why shouldn't write code this), if nid
= id_color_green
, m_ncurrentcolor
1. likewise, if nid
= id_color_blue
, m_ncurrentcolor
2.
Comments
Post a Comment