Attention, contest! - page 13

 

Oops )

I agree with the derebane option and a public discussion would be most useful.

 
TheXpert:
Yes, that's a problem. This topic calls for komposter and tol64

Thank you. I didn't enter the competition because I'm currently working on a very big project. It will soon be available to everyone. There will be a lot to discuss and it may be possible to arrange various contests based on it as well. I can't give more details yet. )

 
Well, here we go :)
Класс для работы с кнопками произвольной формы
Класс для работы с кнопками произвольной формы
  • 2015.03.18
  • Dmitriy Parfenovich
  • www.mql5.com
Класс предназначен для создания интерактивных кнопок на графике цены с различными состояниями.
 
fyords:
Here we go :)

Mine is still being tested... I'll let you know when I see it...

Added:

Here comes my option:)

 
fyords:

Have a look - 5 points :) If the user doesn't need the standard library, your version is better.

I'm actually bothering with this library because I have a program I'm working with now, written on its basis. The design is very clumsy, I wanted to improve it. And here I have just got a contest, which is very relevant to me.

From the pros of your implementation:

1)There are no crutches. I've got it and inheritance of standard classes and other pleasures to support compatibility with standard library.

2)Button status and object status on the chart coincide.

3)Functions have input value checking for errors. I, in some places, overlooked this...

4)Buttons are created more elegantly in Expert Advisor (through nested cycle). I have not thought about it.

5)You can set not only the chart angle, but also the button angle. Honestly - I do not know where it can be useful :) but maybe...

6) I have6 pictures. I have 4.

7)CCanvas - you can write something on the button, add a couple of functions and that's it. It is very convenient in case of multi-language applications. I would have to make crutches again.

8)Your code is much faster to understand.

I have noticed some improvements:

1)If you reduce chat so that the button is partially hidden (bottom or top) - button backlight is not reset (see picture) .

2)I have not seen an option to create a "non-stick button". I.e. button that has sunk and immediately fell off (similar to standard buttons).

3)You have a much more complicated way of defining transparency. I don't even understand how it works everywhere. If you prepare the images yourself, it's easier to do as I have. I.e.I just take transparency from image with function (thanks to Integer ):

double GetAlfa(uint  aColor)
  {
   return((aColor>>24)&0xff);
  }

And then I check it with threshold level (I've taken 250, but of course I need to add function, so I can set it):

 double alfa=GetAlfa(data[y*m_SizeX+x]);
 if(alfa>250)
   {
    m_T[y*m_SizeX+x]=true;
   }
 else
   {
   m_T[y*m_SizeX+x]=false;
   }

Although, if you work with ready-made pictures without opening graphical editor, then your version is likely to be more convenient.

ZS: I just noticed that CCanvas class also has transparency definition function:

#define  GETRGBA(clr)   uchar((clr)>>24)
 

Thank you. I'll have a look at yours.

MigVRN:

What I've noticed that could be improved: ...

  1. If the pointer goes outside the window, the event "move mouse" is not generated, and therefore it seems impossible to fix this bug.
  2. The task didn't have them, although it won't take much effort to fix it.
  3. With transparency it seems to me everything is simpler: take 2e points (the darkest and brightest), the average value will be a threshold. If there are transparent areas in the picture, then the darkest colour will shift towards 0. Therefore, the threshold value will also.
    This decision was made due to the fact that the same function works with both transparency and a separate mask.
    I would also like to mention that this method (separate mask) allows you to use images without transparency. Well, maybe the developer is not good with graphics editors :)
    Or, variant with specification of colour of mask - as variant to specify white colour for green button and it "will become transparent", without additional dancing around transparency and additional masks.
 
MigVRN:

I did a job for you there... I'm waiting for the response.

Thank you to the participants.