oooh! I'm looking at PDF. Lots of very interesting stuff there, Eros. Really hope you can find time to get round to documenting/adding help for it all... :)
Printable View
oooh! I'm looking at PDF. Lots of very interesting stuff there, Eros. Really hope you can find time to get round to documenting/adding help for it all... :)
Hi Eros,
It seems a lot of work has done behind the scene. Thank you for your hard work. While inspecting the pdf you posted here, i've noticed the <Control Property GET/SET:<ControlName>.BackColor. I wonder how that works internally, especially when we used buttons. I mean, i am trying to do it in FreeBasic but i can't set my button back color. I can see that my buttons have a colored outline instead of a complete back color. These are the steps i followed.
Case WM_CTLCOLORBTN message,
Get dc_handle from wparam
SetBkMode(dc_Handle, Transparent)
SetBkColor(dc_Handle, myColor)
Set hBrush with CreateSolidBrush(myColor)
Return hBrush
Not all properties are available for all controls.
Button is one of those that do not allow changing colors.
Have a look at attached personalized XPButton create by Jose Rocha years ago.
It is Power Basic code, not far from FreeBasic code. Maybe you can get ideas.
You can also see thinBasic example of XPButton integration executing scripts in \thinBasic\SampleScripts\UI\XPButton\
Ciao
Eros
Hi Eros,
Thanks for the reply.
I saw the xpButton in sample scripts. Let me study the Josep Roca's code. :)
XpButton is available in my WinFBX framework for PowerBasic. It has been implemented a class in the file CXpButton.inc.
BTW I wrote it to demonstrate the use of visual styles, not to change the button background color. I never have had any interest in colored buttons or other controls because they can look horrible if the user selects a different theme.
Attached an old code I took from PowerBasic forum years ago.
It shows how to own draw a button.
Code is to adapt to your needs but can show how to draw a button
Also found this thread that can help: https://forum.powerbasic.com/forum/u...nerdraw+button
As José said ... results can be horrible :)
@Josep Roca,
Thanks for the reply. I know that it looks horrible when you change the system theme. But I want to make a custom button control just for a practice. I just tried and experimented with the code you posted on FreeBasic forum. It worked but the back color is only changed behind the button text area, not the full rect of button. By the way, i have some questions related to CWSTR.inc Which is the best forum to ask it ?
@Eros Olmi,
Thanks for the code sample and the link. Let me check. :)
> By the way, i have some questions related to CWSTR.inc Which is the best forum to ask it ?
http://www.planetsquires.com/protect/forum/index.php
@Jose Roca,
Thanks. :)
myWindow(1).Caption = myBMP(1).Filename
Can just read but not try out yet.
Just one thing: old vb6-controls (and windows) also had an Index so if we have let's say a few windows of the same type that show a bitmap where we draw unto then it was possible to give them all the same name only they had different indexes so these windows can share the same subs or functions. For the event-subs it's easy the user just might use one of the 4 user-values attached to every UI-"object", but if you think about setting properties:
it would be worth to think about to add an index-property to all UI-things that have a name alsoCode:Text1(1).Text = "Hello"
Text1(2).Text = "world!"