Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #68338

Re: Action/logic inside or outside the Windows class?

From Paavo Helde <myfirstname@osa.pri.ee>
Newsgroups comp.lang.c++
Subject Re: Action/logic inside or outside the Windows class?
Date 2019-09-11 20:24 +0300
Organization A noiseless patient Spider
Message-ID <qlbajp$ra3$1@dont-email.me> (permalink)
References <Jb4eF.975226$dw4.193344@fx12.am4> <qlb3ff$e8j$1@dont-email.me> <5E8eF.1039614$c8w1.775269@fx08.am4> <qlb6d3$1rk$1@dont-email.me> <CC9eF.1040257$c8w1.182346@fx08.am4>

Show all headers | View raw


On 11.09.2019 19:51, JiiPee wrote:
> On 11/09/2019 17:12, Paavo Helde wrote:
>> No, in your example you just forwarded some GUI related logic to
>> another class, for no obvious reason. GUI logic should remain in the
>> GUI classes. In general, the program logic classes should not contain
>> word "mouse" or "click".
>>
>> If you click a mouse "out of the border", this might affect the
>> program logic or not. Maybe you want to call PauseCalculation() on
>> your app, for example. If there really is no other effect than
>> changing a message string, then the mouse click function should call
>> logic.SetStatusMessage("...") or something like that.
>
>
> ok, so something like this:
>
> void MyWindow::MouseClick(Point mousePosition)
> {
>      if(mousePosition.x > 150)
>      {
>          logic.SetStatusMessage("...");
>      }
> }
>
>
> So you would leave the mouse condition check there ( if(mousePosition.x
>  > 150)   ), but the action related to it would go to logic class?

Yes, exactly.




Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 11:41 +0100
  Re: Action/logic inside or outside the Windows class? Öö Tiib <ootiib@hot.ee> - 2019-09-11 06:45 -0700
    Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 15:28 +0100
      Re: Action/logic inside or outside the Windows class? Öö Tiib <ootiib@hot.ee> - 2019-09-12 01:05 -0700
    Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 15:45 +0100
    Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 15:53 +0100
      Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 15:58 +0100
  Re: Action/logic inside or outside the Windows class? Paavo Helde <myfirstname@osa.pri.ee> - 2019-09-11 18:22 +0300
    Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 16:45 +0100
      Re: Action/logic inside or outside the Windows class? Paavo Helde <myfirstname@osa.pri.ee> - 2019-09-11 19:12 +0300
        Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 17:51 +0100
          Re: Action/logic inside or outside the Windows class? red floyd <dont.bother@its.invalid> - 2019-09-11 09:56 -0700
            Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 19:42 +0100
          Re: Action/logic inside or outside the Windows class? Paavo Helde <myfirstname@osa.pri.ee> - 2019-09-11 20:24 +0300
            Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 19:42 +0100

csiph-web