• Welcome to PlanetSquires Forums.
 

WinFormsX

Started by Paul Squires, February 03, 2018, 10:58:18 AM

Previous topic - Next topic

Paul Squires

Quote from: raymw on February 08, 2018, 12:43:17 PM
I've been randomly going through some of the button actions - resizing, moving, etc. A simple form1.button1.hide inside the the button2_click function hides button1 as expected, but a similar form1.button1.show in the button3_click function does not make it reappear. Is that correct behavior?

visible true/false are ok, even hide then visible=true works.
When a valid control exists (ie. it has a Window handle) then the Show/Hide methods should work the same as changing that control's Visible property between True and False.

Quote
How to change button background colors?
You can't change the background colors of a standard Windows button. The button would have to ownerdrawn. This has been the case for every standard windows button since the beginning of time.  :)
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Quote from: Paul Squires on February 08, 2018, 04:38:26 PM
When a valid control exists (ie. it has a Window handle) then the Show/Hide methods should work the same as changing that control's Visible property between True and False.

I found the problem. Easy fix. Will be in GitHub upload later tonight.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

raymw

QuoteYou can't change the background colors of a standard Windows button. The button would have to ownerdrawn. This has been the case for every standard windows button since the beginning of time.

well, I guess I can use a label instead of a button. Colours are useful for things like 'emergency stop', and simulation of m/c control panels, etc. I can't remember what I did in VS/C#.

No big deal. Is it possible to turn off the predictive text/hint, for button.background, and similar? 

Paul Squires

Quote from: raymw on February 08, 2018, 06:57:15 PM
No big deal. Is it possible to turn off the predictive text/hint, for button.background, and similar? 

I put Background as part of the base Control class and Button extends from that Control class. That's why it appears. Technically, you're right, the Control class should only contain properties that are common to EVERY control. Not sure if there is a way to selectively select some elements of the class and not others.

I have uploaded new code to GitHub a few minutes ago.

Now that the form and a couple of controls exist, I will create documentation for them to explain what properties, methods and events are valid for each control. That is important because I don't want to get too deep into development and then have to document everything later (I am quite lazy when it comes to documentation). I have found a great free markdown editor called Typora (https://typora.io/) and can easily create PDF's from it.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

raymw

#19
I've been looking at buttons, what a sad life... Anyway, in your editor, when the compiler results window shows, the 'OK' button changes background color (to light blue) when selected. The winformx buttons change the outline when clicked. Here https://msdn.microsoft.com/en-us/library/windows/desktop/dn742402(v=vs.85).aspx the backgrounds are shaded and borders are different. Now, it seems that more recent (win 8?) 'cleaner page' concept does not use buttons with borders, but labels. I seem to remember, from somewhere, that the standard message box buttons changed, depending on the version of windows being used. I checked back in my c# prog. and found that the .net button allows background colors.
Anyway, you've an hbackbrush get, which returns a value for the button, but no set equivalent listed, afaik. Also, no fonts?

Paul Squires

Hi Ray, yes command buttons have changed over the years but that is mostly due to the Windows version and if theming has been enabled for the application. For our examples, we include resource.rc which then includes the theming manifest file that allows for the blue/shade/borders stuff. Background colors in .Net buttons are possible because those buttons are not pure Win32 api buttons but rather custom controls built for .Net. We could do something similar for example using Jose's XP button. We could make that button the standard/default button for WinFormsX and then we'd have a lot more styling options than the default operating system based button. Certainly something to ponder and consider especially at this early stage of development.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

raymw

wrt the font, firefly has font choices. I think it would be good to have custom controls if possible. I guess it depends on the end user as to whether standardization is desirable. As well as colorful buttons, I would have an interest in the possibility of text or list boxes, with integrated labels.  Of course, this all could be added later, provided allowances were made early in your development. I'm not sure about defaults. Whether they should be simple, so that a quick and dirty? solution can be made, then tart it up afterwards, or spend time in initial micro programming the detailed appearance, and delay the completion of the answer. I'm tending towards initial simplicity, almost to the extent of having a standard size for a default button, just specify location and text. But then, a fully design-able button could have suitable defaults to achieve the same simplicity of use, and allow adjustments later on. I guess, from your point of view, writing the code to generate all this, it would probably be simpler to only create the basic features.

Anyway, fwiw, the buttons work ok, as do the labels as far as I can tell. Looking forward to text boxes, maybe options and lists, then I can try my next project. 

Paul Squires

Thanks Ray - also the benefit of using a custom control button (like Jose's XP button) as the standard base button for the library would be that button also handles graphics and text/graphics. It is kind of an all-in-one solution. That button could be further extended to use gdiplus so that images other than bitmaps and icons (such as PNG images) could be used. That would be awesome.

I haven't implemented the font stuff yet because I want to do it via a class and wanted to have a couple of existing controls firsts to give me an idea of how best to implement it.

Once the guts of the library is there then adding additional controls almost becomes trivial.

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

Hi Paul, new examples work properly with resource.rc as the last param in Compiler Setup / Additional Compiler options. But when removed and uncomment #RESOURCE "resource.rc", I get the following error:

FreeBASIC Compiler - Version 1.06.0 (11-03-2017), built for win64 (64bit)
Copyright (C) 2004-2016 The FreeBASIC development team.
standalone
target:       win64, x86-64, 64bit
compiling:    C:\WinFormsX-master\examples\StatusBarTest.bas -o C:\WinFormsX-master\examples\StatusBarTest.c (main module)
C:\WinFormsX-master\examples\StatusBarTest.bas(19) error 17: Syntax error, found 'RESOURCE' in '#RESOURCE "resource.rc"'
Clive Richey

Paul Squires

You are not supposed to uncomment #RESOURCE.

WinFBE scans the code for "compiler directives" and these directives start with the comment ' character.

'#RESOURCE
'#CONSOLE

Those are the only two directives that exist at this point.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Also, I have uploaded 2 PDF's to GitHub. Tomorrow I will create more PDFs for each of the form/controls.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

raymw

Hi Paul, at the moment, I have no resource.rc in the compiler command line, and if I remove the '#resource "resource.rc" from the program, it apparently compiles and runs the same. That's on w10, 32bit, freebasic 1.05. To me, it looks as if the resource.rc refers to an xml file with various windows versions. Is it safe to have a comment that should not be removed? . Thanks for the pdf's, etc.

SeaVipe

Thanks.
Similar in syntax to a Metacommand?
'$Include - Alternate form of the #include directive.
'$Dynamic - Alternate form of the Option Dynamic statement.
'$Static - Alternate form of the Option Static statement.
'$Lang - Alternate form of the #lang directive.
Clive Richey

Paul Squires

Quote from: raymw on February 09, 2018, 09:52:24 PM
Hi Paul, at the moment, I have no resource.rc in the compiler command line, and if I remove the '#resource "resource.rc" from the program, it apparently compiles and runs the same. That's on w10, 32bit, freebasic 1.05. To me, it looks as if the resource.rc refers to an xml file with various windows versions. Is it safe to have a comment that should not be removed? . Thanks for the pdf's, etc.
Yes, it will run without the resource but the app not be correctly themed or dpi aware. Every app should have a manifest and that resource loads the manifest.

More pdfs to come  :)
If you what more explanations, etc that you think should be in a pdf then please let me know. I want to get off on the right track with regards to documentation. If I document as I develop then the task won't be so difficult than if I waited until the development was complete.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Quote from: SeaVipe on February 09, 2018, 10:04:36 PM
Thanks.
Similar in syntax to a Metacommand?
'$Include - Alternate form of the #include directive.
'$Dynamic - Alternate form of the Option Dynamic statement.
'$Static - Alternate form of the Option Static statement.
'$Lang - Alternate form of the #lang directive.

Yes, that's basically correct. I could have called it anything but chose to use '#RESOURCE. Hopefully that doesn't become confusing to users.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer