Author Topic: New TextButton example with multiple image backgrounds.  (Read 1125 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5835
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
New TextButton example with multiple image backgrounds.
« on: January 22, 2018, 06:22:44 PM »
I removed the earlier ones as they were only taking up space. This version is complete and displays the text buttons properly and the test app will display 3 different background images in the client area. You could do many more but I did not want the file to end up too large.

You can set a TTF font of your choice and make the display area of each button at whatever size you require. The text can be changed and you can set the alignment of the text using the normal DrawText options. The fixed arguments, handle, instance and 4 colours are set in a structure to keep the argument count down and you can only use a single set of 4 colours for the application as mixed button colours usually look terrible on an interface.

At some later point I will put the code for the text button into a library module so its easier to use.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

LiaoMi

  • Member
  • ***
  • Posts: 320
Re: New TextButton example with multiple image backgrounds.
« Reply #1 on: January 22, 2018, 10:16:37 PM »
Hi hutch,

thanks for the interesting example, I have a very fast mouse, so when I quickly go through the first three buttons, in the middle button there are black bars, because of this, it is felt that the button is flickering. If the mouse is within one button, this flicker reappears, someone else might have noticed this effect ?!  :icon_eek:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5835
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: New TextButton example with multiple image backgrounds.
« Reply #2 on: January 22, 2018, 11:36:30 PM »
What happens if you just drag the mouse slowly up or down the buttons ? It sounds like with the mouse set very fast that each control is missing out on some of the internal messages. I tried doing the same with my own mouse movements which are also fast and I got one sweep that left one of the button showing red text but passing the mouse back over the buttons brought it back to normal.

It may be an effect of some lag in the TrackMouseEvent code. I just tried putting the InvalidateRect call after the TrackMouseEvent call but it made no difference.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

LiaoMi

  • Member
  • ***
  • Posts: 320
Re: New TextButton example with multiple image backgrounds.
« Reply #3 on: January 23, 2018, 12:22:50 AM »
The same thing happens, sometimes even with very slow movement. The flicker is noticeably clearer, if you move the mouse only horizontally, sometimes the whole text blinks.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5835
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: New TextButton example with multiple image backgrounds.
« Reply #4 on: January 23, 2018, 02:01:06 AM »
I am using Win10 64 pro and the machine is a 3.3 gig Haswell E/EP. What OS and processor are you using ?

I just tested in on my Win7 64 Ultimate box which is an old 2.8 gig i7 and it works perfectly so I don't know what is going on with the results you mentioned.

The Win10 box is using a corded Microsoft mouse, the old i7 is using a Logitech cordless mouse and both are set up with fast mouse settings.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

LiaoMi

  • Member
  • ***
  • Posts: 320
Re: New TextButton example with multiple image backgrounds.
« Reply #5 on: January 23, 2018, 03:01:32 AM »
I have win 10 ent, the last build, intel i7-4810mq processor. I'll try on other machines and share the results  :P

Magnum

  • Member
  • *****
  • Posts: 2284
Re: New TextButton example with multiple image backgrounds.
« Reply #6 on: January 23, 2018, 03:07:12 AM »
I removed the earlier ones as they were only taking up space. This version is complete and displays the text buttons properly and the test app will display 3 different background images in the client area. You could do many more but I did not want the file to end up too large.

You can set a TTF font of your choice and make the display area of each button at whatever size you require. The text can be changed and you can set the alignment of the text using the normal DrawText options. The fixed arguments, handle, instance and 4 colours are set in a structure to keep the argument count down and you can only use a single set of 4 colours for the application as mixed button colours usually look terrible on an interface.

At some later point I will put the code for the text button into a library module so its easier to use.

Works well in Ubuntu Mate 16.04.

Andy
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org