PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: win fbe 1.7.6 button colours  (Read 793 times)

raymw

  • FireFly3 User
  • Senior Member
  • *
  • Posts: 218
win fbe 1.7.6 button colours
« on: August 26, 2018, 10:06:44 PM »

Hi Paul,
wrt my previous labels and button testing  - labels now OK but buttons not so
Code: [Select]
Function Form1_Button1_MouseDown( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
   form1.button1.BackColordown=colors.red
   bcount=bcount+1
      form1.button2.Text= form1.button2.text + " try"+ str(bcount)
   Function = 0
End Function

''
''
Function Form1_Button1_MouseUp( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
  form1.button1.BackColor=colors.blue
   Function = 0
End Function

blue only shows when mouse leaves button1, text in button2 does not update immediately - button2 text updates when it gets focus. I'm arguing with myself if backcolor change should be similar to label, instead of having to use backcolordown. Or, why do we need mouse clicks on labels?
Logged

Paul Squires

  • Administrator
  • Master Member
  • *****
  • Posts: 8632
  • Windows 10
    • PlanetSquires Software
Re: win fbe 1.7.6 button colours
« Reply #1 on: August 26, 2018, 10:25:19 PM »

When you MouseUp on the Button, the mouse is still over the button... therefore, the BackColorHot color will be used until the mouse leaves the button area. Sooooooooo.... in addition to setting the BackColor in MouseUp, you should also set the BackColorHot color.

Also, looks like you need to manually Refresh the caption. I will modify the underlying source to do the refresh when the text is set on the button.

Function Form1_Button1_MouseDown( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
   form1.button1.BackColordown=colors.red
   bcount=bcount+1
      form1.button2.Text= form1.button2.text + " try"+ str(bcount)
      form1.button2.Refresh
   Function = 0
End Function

''
''
Function Form1_Button1_MouseUp( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
  form1.button1.BackColor=colors.blue
  form1.button1.BackColorHot=colors.blue
   Function = 0
End Function
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

raymw

  • FireFly3 User
  • Senior Member
  • *
  • Posts: 218
Re: win fbe 1.7.6 button colours
« Reply #2 on: August 27, 2018, 09:11:24 AM »

Hi Paul,
Thanks for reply. I was aware of the backcolorhot property, but wondering why it is as it is, compared to the label functionality. I guess what happens, as software languages/whatever develops, stuff gets added, it becomes more complex. And a bit like the qwerty keyboard, it is what it is through historic reasons, not necessarily the 'best' reasons today. Anyway, thanks to today's 'codeproject' I found a link to my ideal language https://www.codeproject.com/News.aspx?ntag=19837497624856860&_z=2684255  looks simple, can't wait to give it a try.  :)
Logged

Paul Squires

  • Administrator
  • Master Member
  • *****
  • Posts: 8632
  • Windows 10
    • PlanetSquires Software
Re: win fbe 1.7.6 button colours
« Reply #3 on: August 27, 2018, 09:39:07 AM »

:D  That made me laugh this morning
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

raymw

  • FireFly3 User
  • Senior Member
  • *
  • Posts: 218
Re: win fbe 1.7.6 button colours
« Reply #4 on: August 27, 2018, 10:09:11 PM »

button text refresh OK in vers 1.7.7, but text does not scroll/multiline I think a few releases ago, you said you were removing properties/events that you had not yet implemented. I've just noticed that for label, mouse down/up works for both left and right mouse buttons and thumbwheel, whereas for button only for left mouse button. (I guess you'll be adding button events for mouse right and thumbwheel. This could run into fifteen pages of just button mouse events...)
« Last Edit: August 27, 2018, 10:26:43 PM by raymw »
Logged

Paul Squires

  • Administrator
  • Master Member
  • *****
  • Posts: 8632
  • Windows 10
    • PlanetSquires Software
Re: win fbe 1.7.6 button colours
« Reply #5 on: August 27, 2018, 10:50:19 PM »

To differeniate the mouse buttons, you can check the EventArgs variable "e"

Function Form1_Button1_MouseDown( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
   form1.button1.BackColordown=colors.red
   bcount=bcount+1
   form1.button2.Text= form1.button2.text + " try"+ str(bcount)
   if e.RButton then
      ? "Right mouse click"
   end if
   Function = 0
End Function

Buttons will not have multiline because the styles will not allow them without screwing up existing alignments.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

raymw

  • FireFly3 User
  • Senior Member
  • *
  • Posts: 218
Re: win fbe 1.7.6 button colours
« Reply #6 on: August 28, 2018, 09:03:07 AM »

Hi Paul,
I'm looking at this from the point of view of a newcomer to this visual programming of basic, as opposed to someone steeped in the intricacies of historic basic programming. From that point of view, I'm looking for consistency within the user interface. So, if on a property, only the left button of mouse can be easily used to create an event, then that should be the same for all properties where mouse clicks are allowed i.e. any mouse button within the label has an effect, whereas only the left within a button. I've not tested other properties for this consistency. But then, that's maybe just me going off on one. Of course, this could be completely avoided, if a label was treated purely as a label, i.e. an area for only displaying text, and mouse clicking whatever creates no events in that property, in the same way as key presses have no events.

Generally, except for form size problems, a single line of text on buttons is sufficient. However, for touch screen, square buttons are better than oblong, in which case two or more lines of text would be useful, hence my queries re scrolling. I suppose I should be suggesting round buttons for touch screens  :-[

I'm pretty certain, that whatever I want to do, with help from here, I can get it done, but the boundary between easy and hard is not necessarily where I want it to be - such is life.

Best wishes,

Ray
Logged

Josť Roca

  • FireFly3 Registered User
  • Master Member
  • *
  • Posts: 3109
    • Jos
Re: win fbe 1.7.6 button colours
« Reply #7 on: August 28, 2018, 09:47:29 AM »

Well, if somebody isn't willing to learn, it must not choose to work with a low-level compiler and the Windows API. There are languages such the VB.NET and C# that can use all the classes provided by the .NET framework and there is plenty of code available in the web to copy.

BTW using two lines of text with CXpButton is as easy as using carriage returns in the button text to break the lines

<button>.Text = "&Classic Button" & CHR(13) & "second line"

and set the TextFormat property to

<button>.TextFormat = DT_WORDBREAK OR DT_CENTER
« Last Edit: August 28, 2018, 09:55:28 AM by Josť Roca »
Logged

Johan Klassen

  • FireFly3 Registered User
  • Junior Member
  • *
  • Posts: 73
  • FF3 User
Re: win fbe 1.7.6 button colours
« Reply #8 on: August 28, 2018, 10:00:41 AM »

@raymw
I don't understand your complaint about events related to labels, you intercept/use only the events that you want.
Logged

raymw

  • FireFly3 User
  • Senior Member
  • *
  • Posts: 218
Re: win fbe 1.7.6 button colours
« Reply #9 on: August 28, 2018, 11:08:56 AM »

@raymw
I don't understand your complaint about events related to labels, you intercept/use only the events that you want.

I'm not complaining, more likely making an observation. The boundary between a label and button is fuzzy, and where will the fuzziness stop? Why not have key presses in labels, and multi-line text in buttons, then you can add in more similar behavior, and all that will be different will be the name?

Quote
Well, if somebody isn't willing to learn, it must not choose to work with a low-level compiler and the Windows API.
Hi Jose, I thought the idea of the visual designer was to isolate the user from much of the windows api stuff. I can do most of what I need want to do. It's just there appears to be a few boundaries which to me are in odd places. It is no big deal for me, just trying to make suggestions, test stuff, try and break it, whatever. I am very grateful to you and Paul for what you are both doing, although I must admit that I have little idea of how and, in some ways, why you do it.

Best wishes,
Ray
Logged

Josť Roca

  • FireFly3 Registered User
  • Master Member
  • *
  • Posts: 3109
    • Jos
Re: win fbe 1.7.6 button colours
« Reply #10 on: August 28, 2018, 11:49:00 AM »

If you used standard buttons you will quickly notice the difference between a button and a label, both in aspect and behavior. Now, there are some users that have the caprice of using colored buttons. For doing that, visual styles need to be disabled and the button to be drawn using GDI, and they end looking like a label. There are still some differences like a label can't gain the focus. Paul knows that I was very reluctant to make the changes needed to work with different background and foreground colors because I find these buttons shabby.

raymw

  • FireFly3 User
  • Senior Member
  • *
  • Posts: 218
Re: win fbe 1.7.6 button colours
« Reply #11 on: August 28, 2018, 12:31:20 PM »

Hi Jose,

Thanks for your explanation wrt button/label colours. I sort of agree, that there should be a clear distinction. However, much of windows 10 uses coloured buttons (can be readily emulated using Paul's labels), and as I often sort of simulate machine tools which often have colored buttons -e.g. red for emergency stop. However, I've seen some really garish examples, particularly in web pages. Thinking of which, why not have html5 (maybe have to be a subset) to freebasic as the gui? ( I can almost hear you screaming  :o)

Best wishes,

Ray
« Last Edit: August 28, 2018, 12:44:19 PM by raymw »
Logged

Josť Roca

  • FireFly3 Registered User
  • Master Member
  • *
  • Posts: 3109
    • Jos
Re: win fbe 1.7.6 button colours
« Reply #12 on: August 28, 2018, 01:02:39 PM »

> Thinking of which, why not have html5 (maybe have to be a subset) to freebasic as the gui?

"Ignorance is bliss". The Windows API doesn't speak HTML, only the Internet Browsers do. If you want to write a GUI using HTML, use a browser.

Josť Roca

  • FireFly3 Registered User
  • Master Member
  • *
  • Posts: 3109
    • Jos
Re: win fbe 1.7.6 button colours
« Reply #13 on: August 28, 2018, 02:05:06 PM »

In fact, HTML buttons can be used by hosting the WebBroser control. I have done it. But to implement it into the Visual Designer won't be easy. If Paul gets bored... :)
« Last Edit: August 28, 2018, 02:07:06 PM by Josť Roca »
Logged

raymw

  • FireFly3 User
  • Senior Member
  • *
  • Posts: 218
Re: win fbe 1.7.6 button colours
« Reply #14 on: August 28, 2018, 02:43:53 PM »

We have to work on stopping Paul from getting bored, or distracted. I think I'd better keep quiet about buttons. Anything more exciting?
Logged
Pages: [1] 2