diff --git a/uppsrc/CtrlLib/LineEdit.cpp b/uppsrc/CtrlLib/LineEdit.cpp index 8a69acd6c..603beb738 100644 --- a/uppsrc/CtrlLib/LineEdit.cpp +++ b/uppsrc/CtrlLib/LineEdit.cpp @@ -446,8 +446,7 @@ void LineEdit::LeftTriple(Point, dword) void LineEdit::MouseMove(Point p, dword flags) { if((flags & K_MOUSELEFT) && HasFocus() && HasCapture()) { int c = GetMousePos(p); - if(mpos != c) - PlaceCaret(c, true); + PlaceCaret(c, mpos != c); } } diff --git a/uppsrc/CtrlLib/srcdoc.tpp/MenuCb$en-us.tpp b/uppsrc/CtrlLib/srcdoc.tpp/MenuCb$en-us.tpp index 35a853281..56752fbe1 100644 --- a/uppsrc/CtrlLib/srcdoc.tpp/MenuCb$en-us.tpp +++ b/uppsrc/CtrlLib/srcdoc.tpp/MenuCb$en-us.tpp @@ -1,12 +1,127 @@ -TITLE("About Callbacks and Bars") -COMPRESSED -120,156,165,88,139,142,219,198,21,253,149,65,214,117,164,53,87,224,188,248,144,154,34,155,141,3,27,69,210,162,118,16,20,139,69,69,73,163,21,107,138,84,73,106,31,72,236,111,239,185,51,164,72,106,229,181,139,218,176,173,165,230,190,206,61,247,204,165,175,5,123,241,194,247,252,51,255,11,191,166,63,154,117,178,207,234,155,235,76,68,209,44,229,92,248,179,132,135,179,191,197,179,79,159,62,77,184,242,163,25,57,227,112,198,125,37,185,224,120,230,43,17,114,29,251,177,142,120,228,203,80,9,29,250,122,186,75,202,100,123,115,157,68,114,118,254,143,0,86,194,211,103,146,75,238,243,64,40,156,242,165,47,20,23,154,71,145,226,161,142,100,28,4,211,101,178,171,211,34,191,185,94,144,157,130,153,132,153,31,70,129,226,48,82,90,200,80,43,24,43,133,244,36,2,135,65,24,78,235,180,206,204,205,117,74,121,35,219,43,202,82,121,193,25,178,19,33,44,149,80,129,146,145,144,60,18,34,136,165,138,21,210,230,98,154,214,6,73,46,148,152,37,248,67,102,26, -241,148,86,92,2,17,21,106,137,99,33,254,85,126,204,5,130,70,190,214,136,103,30,90,152,22,0,136,64,34,219,0,33,69,168,201,34,82,17,151,97,36,148,8,4,146,240,67,20,74,25,232,233,202,84,75,216,74,193,103,53,210,154,93,125,175,103,28,198,161,23,158,9,63,246,69,16,198,8,138,132,81,179,140,99,46,35,4,85,92,251,92,78,151,197,10,117,46,132,246,165,141,24,161,21,1,60,91,88,116,192,145,180,144,17,66,134,92,74,252,173,85,20,78,43,67,205,168,139,242,230,250,252,251,145,63,241,39,66,235,49,153,199,48,143,164,146,82,5,177,226,190,68,24,248,80,132,89,224,163,157,92,139,104,186,72,42,196,172,241,40,116,200,114,98,19,176,151,145,150,8,29,224,47,244,21,5,74,224,35,98,21,73,25,249,211,101,150,84,85,3,18,1,116,78,69,114,238,113,126,22,18,182,90,10,21,19,56,82,0,100,17,232,152,3,101,29,40,95,76,75,243,159,125,90,154,173,201,1,115,10,122,204,218,22,53,92,68,50,142,138,194,227,2,100,212, -65,224,19,94,26,132,16,82,3,112,159,71,10,25,225,55,218,92,55,108,92,116,53,72,143,203,179,88,40,137,76,98,165,128,0,28,240,152,115,238,71,248,141,202,128,139,229,7,111,136,213,132,119,230,202,227,234,44,4,141,209,169,88,81,248,88,18,126,2,240,139,192,215,232,131,112,230,130,80,23,47,128,59,23,17,253,177,200,115,237,113,204,3,82,228,90,163,110,9,168,69,132,218,53,176,151,150,226,60,140,166,191,152,251,234,199,164,54,13,97,206,175,94,56,166,241,192,227,193,153,79,246,58,138,209,64,174,8,63,169,84,44,98,41,181,136,181,12,124,224,88,185,129,38,99,26,41,59,142,7,39,161,199,67,12,23,106,213,26,213,91,51,84,30,114,74,69,68,113,64,40,52,78,230,23,89,154,83,30,96,198,204,145,225,252,234,21,231,33,57,138,48,52,81,20,248,50,6,24,192,192,215,96,58,4,33,66,163,209,103,129,49,32,69,88,126,72,110,205,252,162,153,86,155,2,49,80,75,29,17,111,97,137,212,145,4,252,196,190,31,224,73,20,97,154,166, -183,201,110,64,64,225,123,194,7,139,160,63,26,67,137,88,160,159,31,147,150,64,25,208,1,72,81,172,29,3,231,23,185,169,106,179,66,243,181,111,203,22,220,19,28,216,129,127,90,71,74,5,200,23,177,67,146,38,106,33,6,88,135,114,250,247,4,243,242,251,191,62,254,233,245,47,23,191,190,99,215,149,152,177,203,69,177,175,217,85,146,101,11,20,83,177,36,95,177,31,146,178,122,121,115,93,249,51,246,126,147,226,89,89,167,203,204,176,85,90,45,247,85,101,42,182,108,206,179,250,113,103,156,209,122,159,47,73,232,88,113,103,202,172,72,86,21,75,243,187,34,187,51,43,124,32,159,172,216,25,12,45,206,84,108,244,179,201,247,120,230,177,247,69,145,225,195,120,194,16,204,216,115,182,74,70,129,25,77,106,243,115,177,166,47,175,234,50,99,247,155,116,185,57,117,160,241,106,19,106,28,79,154,74,14,5,25,74,58,69,5,108,151,212,181,41,115,246,88,236,81,81,206,42,99,40,213,95,231,175,230,175,24,233,18,91,23,37,219,192,25,136,114,107,97,97, -89,81,0,165,44,253,0,55,192,102,218,243,30,206,216,93,145,174,216,27,147,101,197,111,69,153,173,230,211,169,197,119,52,110,190,159,255,222,124,184,248,99,50,153,180,15,63,54,31,62,235,228,167,52,51,84,218,8,41,204,95,162,230,242,132,67,60,157,92,174,86,163,249,55,54,230,100,50,255,6,232,190,121,251,238,135,203,171,191,142,236,179,241,120,54,56,254,174,149,209,209,209,23,206,207,235,135,180,30,56,185,202,138,202,116,78,190,62,113,209,101,238,1,226,154,221,37,217,255,95,66,186,102,35,56,98,243,239,230,223,49,62,62,60,239,121,124,166,206,255,165,82,248,252,248,153,162,7,245,118,63,156,106,57,196,127,223,4,36,96,6,1,91,164,250,49,143,206,11,24,180,231,249,193,64,120,190,51,233,56,254,198,148,230,224,153,109,147,101,89,48,243,176,3,143,43,86,23,108,120,248,226,143,235,243,195,60,223,140,136,212,30,155,191,60,217,198,241,208,180,111,104,167,177,27,126,12,125,14,45,216,154,237,194,148,12,119,198,46,131,230,119,34,225,38,120, -147,84,61,185,168,55,73,205,224,175,184,199,71,211,218,30,76,22,134,134,144,2,194,185,19,159,2,30,238,12,69,50,30,131,6,122,146,97,96,21,4,235,118,79,55,109,5,81,121,99,242,165,177,14,219,42,58,151,52,244,199,30,60,235,193,222,174,6,234,224,196,141,204,147,221,174,44,118,101,74,117,180,73,147,230,12,80,184,79,179,12,153,66,74,50,179,132,70,35,129,223,54,38,183,14,106,164,101,234,65,5,135,76,210,170,125,62,50,147,219,201,33,215,177,231,98,47,235,61,136,126,168,171,193,10,109,222,65,249,96,5,40,210,230,65,89,220,165,132,255,226,209,154,154,59,24,144,116,67,237,150,27,0,234,160,255,144,23,247,21,219,0,235,109,146,63,246,60,195,77,110,140,99,10,57,183,26,152,16,32,184,4,246,25,196,213,122,68,97,111,93,89,230,33,65,119,145,227,2,168,184,116,59,242,64,70,243,170,46,247,75,12,159,173,176,178,7,122,152,177,155,35,82,44,75,3,136,73,219,219,91,137,21,139,127,3,77,54,42,92,196,141,73,118,99,242, -92,39,105,78,164,160,135,168,57,199,53,252,72,45,233,161,125,112,222,77,24,85,134,22,57,188,155,107,167,29,181,238,124,133,140,141,203,54,89,173,240,177,106,61,31,167,229,210,110,59,191,111,218,65,238,63,67,187,123,98,4,168,231,90,131,214,215,101,122,123,139,161,109,178,65,23,169,147,21,190,47,209,245,85,186,94,227,89,222,93,211,238,194,51,21,105,233,50,219,175,90,12,218,239,249,207,166,222,20,171,203,134,229,116,216,235,46,77,155,33,117,213,214,70,93,67,178,149,105,144,56,142,97,83,177,169,23,205,48,236,43,112,49,123,116,147,147,60,153,211,28,131,179,98,175,31,204,114,95,27,71,212,142,221,39,73,73,233,111,205,18,23,109,90,109,145,198,79,77,110,207,150,67,7,218,32,199,41,212,201,7,36,142,153,238,230,152,141,190,52,24,227,14,161,110,168,142,230,118,56,180,109,103,159,174,24,128,140,244,48,171,10,0,116,208,108,39,197,109,39,172,210,85,172,218,153,101,186,198,62,226,150,167,53,35,102,128,113,41,253,140,238,227,130,219,119, -48,14,51,59,41,37,67,1,17,227,231,232,246,116,55,58,206,150,22,162,142,39,237,172,127,221,109,194,191,112,157,8,143,249,227,167,41,28,190,62,110,104,125,95,244,132,217,81,96,157,150,85,77,176,29,154,87,237,119,187,44,125,70,0,91,65,175,12,36,132,20,106,11,223,235,178,216,182,195,62,132,222,111,91,228,22,89,171,53,88,108,187,134,29,16,3,117,47,217,174,168,170,116,145,89,33,104,166,44,181,203,44,176,234,46,183,99,117,234,75,146,203,101,139,55,148,148,176,198,205,185,52,213,196,99,38,65,129,93,165,86,239,144,21,73,54,174,155,53,2,182,58,208,171,225,128,87,111,174,6,189,244,78,106,90,183,186,59,217,195,154,127,56,211,159,198,203,242,150,79,28,160,116,210,25,15,165,115,136,230,200,119,32,90,73,192,138,213,84,62,228,245,9,6,60,171,153,111,215,118,135,39,196,201,252,152,194,247,105,189,57,33,84,118,166,90,169,128,158,145,94,180,247,32,249,201,79,35,211,1,242,57,68,190,82,15,68,155,94,95,14,136,227,61,208,250, -155,204,251,19,75,145,213,114,91,95,235,213,235,182,26,223,235,237,68,221,224,52,76,56,160,228,157,92,183,182,123,204,149,147,248,154,101,38,161,41,27,8,170,125,233,235,249,17,39,221,28,146,57,149,200,16,167,183,235,147,30,108,137,205,224,13,151,90,59,86,189,141,115,168,124,35,188,103,140,199,93,35,237,11,221,125,145,207,191,173,105,230,119,56,54,113,59,76,195,69,203,33,155,43,104,72,92,74,168,190,251,164,92,185,11,234,4,123,96,153,23,117,47,135,9,27,253,211,189,77,82,24,43,69,143,61,82,217,183,101,75,101,138,69,220,59,94,48,158,208,212,209,219,74,93,111,89,236,34,186,238,81,107,40,163,249,183,168,101,131,119,151,156,173,204,206,144,70,23,253,237,211,99,139,125,61,152,192,190,28,181,28,237,97,90,217,197,178,169,7,131,138,60,173,48,140,143,155,119,226,154,112,169,209,86,117,12,158,123,151,127,250,206,112,56,64,228,114,115,49,88,202,90,208,45,39,142,10,44,77,189,199,203,188,147,153,102,85,27,236,230,61,68,91,37,60, -236,102,39,150,216,198,159,157,244,231,220,81,62,135,77,229,207,246,61,247,47,160,193,219,230,63,18,188,167,27,85,5,184,107,55,181,32,136,41,93,31,174,108,209,79,182,140,202,81,18,226,208,30,92,142,39,45,234,55,255,5,131,13,84,198, +topic "About Callbacks and Bars"; +[2 $$0,0#00000000000000000000000000000000:Default] +[l288;i1120;a17;O9;~~~.1408;2 $$1,0#10431211400427159095818037425705:param] +[a83;*R6 $$2,5#31310162474203024125188417583966:caption] +[b83;*4 $$3,5#07864147445237544204411237157677:title] +[i288;O9;C2 $$4,6#40027414424643823182269349404212:item] +[b42;a42;2 $$5,5#45413000475342174754091244180557:text] +[l288;b17;a17;2 $$6,6#27521748481378242620020725143825:desc] +[l321;t246;C@5;1 $$7,7#20902679421464641399138805415013:code] +[b2503;2 $$8,0#65142375456100023862071332075487:separator] +[*@(0.0.255)2 $$9,0#83433469410354161042741608181528:base] +[t4167;C2 $$10,0#37138531426314131251341829483380:class] +[l288;a17;*1 $$11,11#70004532496200323422659154056402:requirement] +[i417;b42;a42;O9;~~~.416;2 $$12,12#10566046415157235020018451313112:tparam] +[b167;C2 $$13,13#92430459443460461911108080531343:item1] +[i288;a42;O9;C2 $$14,14#77422149456609303542238260500223:item2] +[*@2$(0.128.128)2 $$15,15#34511555403152284025741354420178:NewsDate] +[l321;*C$7;2 $$16,16#03451589433145915344929335295360:result] +[l321;b83;a83;*C$7;2 $$17,17#07531550463529505371228428965313:result`-line] +[l160;t4167;*C+117 $$18,5#88603949442205825958800053222425:package`-title] +[2 $$19,0#53580023442335529039900623488521:gap] +[t4167;C2 $$20,20#70211524482531209251820423858195:class`-nested] +[b50;2 $$21,21#03324558446220344731010354752573:Par] +[{_}%EN-US +[s2; About Callbacks and Bars&] +[s0; This article discusses callback types and function overloads +involved in Bar operations (MenuBar, ToolBar). The Bar class +is a base class of BarCtrl which is a base class of MenuBar and +ToolBar.&] +[s0; &] +[s0; The typical pattern you can see in U`+`+ code for handling Bars +looks like this:&] +[s0; &] +[s7; void HelloWorld`::About()&] +[s7; `{&] +[s7; -|...&] +[s7; `}&] +[s7; &] +[s7; void HelloWorld`::FileMenu(Bar`& bar)&] +[s7; `{&] +[s7; -|bar.Add(`"About..`", THISBACK(About));&] +[s7; -|bar.Separator();&] +[s7; -|bar.Add(`"Exit`", THISBACK(Close));&] +[s7; `}&] +[s7; &] +[s7; void HelloWorld`::FileMenu2(Bar`& bar, int val)&] +[s7; `{&] +[s7; -|bar.Add(`"About..`", THISBACK(About));&] +[s7; -|if (val `=`= 1)&] +[s7; -|`{&] +[s7; -|-|bar.Separator();&] +[s7; -|-|bar.Add(`"Exit`", THISBACK(Close));&] +[s7; -|`}&] +[s7; `}&] +[s7; &] +[s7; HelloWorld`::HelloWorld()&] +[s7; `{&] +[s7; -|menu.Add(`"File`", THISBACK(FileMenu));&] +[s7; -|menu.Add(`"File2`",THISBACK1(FileMenu2,0);&] +[s0; &] +[s0; Here THISBACK macro expands to &] +[s0; &] +[s0; -|[* callback](this, `&HelloWorld`::FileMenu)&] +[s0; &] +[s0; [* callback] is an overloaded non member template function which +has overloads that allow the member function being called back +to have none, 1,2,3 or 4 arguments. Hence the FileMenu function +can have none, 1,2,3,or 4 parameters and the appropriate overload +of [* callback] will be selected. When the target called back +function is called (e.g. FileMenu), the actual arguments that +are passed to it are provided by the event dispatcher which knows +how many arguments it needs to pass for a particular event. +In the example above, the HelloWorld constructor calls the [* callback +]function which creates a Callback object (on the heap) containing +the identity of the target function (FileMenu) to be called. + The menu.Add function stores the address of the Callback object +which will be used to call the FileMenu function when an event +is triggered. There are several different Callback classes, +including the Callback1MethodAction class, which is used for +the above case. The Callback classes are functors and usually +have a member function named Execute that is called by the event +dispatching mechanism. For the Callback1MethodAction class, +the Execute member function takes one parameter (provided by +the event dispatcher) which is passed to the target callback +function FileMenu.&] +[s0; &] +[s0; There is also a THISBACK1 macro, which allows specification +of an additional value that is passed to the called back function +(e.g. FileMenu2) when an event is triggered.&] +[s0; &] +[s0; The THISBACK1 macro in the above example expands to &] +[s0; &] +[s0; -|[* callback1](this, `&HelloWorld`::FileMenu2, 0)&] +[s0; &] +[s0; The FileMenu2 function takes two parameters, the first of which +is supplied by the event dispatcher and the second comes from +the additional value 0 specified in the invocation of THISBACK1. + A possible use for this is to allow the target function to be +called from multiple places., each of which identifies itself +using the additional parameter. For the above example, the Callback +object involved is of type CallbackMethodActionArg1.and this +object stores the additional value (0 in this case) to be passed +to the FileMenu2 function when an event is triggered. If you +use the THISBACK1 macro with a member function that takes only +one argument then the Callback object is of type CallbackMethodActionArg.&] +[s0; &] +[s0; There is also a THISBACK2 macro which allows two additional +arguments. The member function used with THISBACK, can have +0,1,2,3 or 4 parameters. For THISBACK1, the member function +must have at least one parameter and for THISBACK2 the member +function can have 2,3 or 4 parameters.&] +[s0; &] +[s0; If the member function used in the THISBACK macros is overloaded +(e.g. FileMenu(int)) then the code won`'t compile. In this case +you have to use a forwarding member function that is not overloaded. +(You can`'t supply argument types when you take the address of +a member function. If the function is overloaded, the one that`'s +chosen depends on the target, but in this case the target is +also overloaded so it can`'t be resolved).&] +[s0; &] +[s0; In the above example, the Add member function of Bar is an overloaded +function and which Add function that is used depends on the return +value of the [* callback] function. For the FileMenu example above, +the return type of the [* callback] function is Callback1. +(In U`+`+, Callback classes start with upper case C and callback +functions have lower case c). &] +[s0; ] \ No newline at end of file