• Welcome to PlanetSquires Forums.
 

win fbe 1.7.6 button colours

Started by raymw, August 26, 2018, 10:06:44 PM

Previous topic - Next topic

raymw

Hi Paul,
wrt my previous labels and button testing  - labels now OK but buttons not so
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?

Paul Squires

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
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

raymw

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.  :)

Paul Squires

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

raymw

#4
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...)

Paul Squires

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.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

raymw

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

José Roca

#7
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

Johan Klassen

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

raymw

Quote from: Johan Klassen 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.

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?

QuoteWell, 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

José Roca

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

#11
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

José Roca

> 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

#13
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... :)

raymw

We have to work on stopping Paul from getting bored, or distracted. I think I'd better keep quiet about buttons. Anything more exciting?