xsharp.eu • Change SLE Resouce settings realtime
Page 1 of 2

Change SLE Resouce settings realtime

Posted: Mon Feb 17, 2020 11:30 pm
by ic2
We capitalize our City field in an address database by setting Conversion to Uppercase. This is set in the resource, as follows:

CONTROL "City:", RELATIEVENSTER_MCITY, "Edit", ES_AUTOHSCROLL|ES_UPPERCASE|WS_TABSTOP|WS_CHILD|WS_BORDER, 150, 137, 156, 16, WS_EX_CLIENTEDGE

Now one client would like to be able to mix cases, so get rid of the upper case conversion. If it was a setting in the init (like oDCmCITY:Picture := "!!!!!!!!!!") I could override it using a setting in the Postinit.

Is it also possible to override "ES_UPPERCASE" resource?

I know I could set a picture instead depending on what the user has chosen but I was just wondering if there's another way, leaving the resource Conversion setting as it is.

Dick

Change SLE Resouce settings realtime

Posted: Mon Feb 17, 2020 11:38 pm
by Chris
Hi Dick,

Why don't you remove the ES_UPPERCASE from the resource (or, if the window is editor generated, set the "Conversion" property of the SLE in the WED to "No Conversion") and then set the picture as you said manually at runtime, so you have full control over this?

Change SLE Resouce settings realtime

Posted: Tue Feb 18, 2020 11:22 am
by Karl-Heinz
Is it also possible to override "ES_UPPERCASE" resource?
Hi Dick,

yes, the style ES_UPPERCASE can be added or removed at runtime.

Code: Select all

<oSle>:SetStyle ( ES_UPPERCASE , <lSet> )
Regards
Karl-Heinz

Change SLE Resouce settings realtime

Posted: Tue Feb 18, 2020 4:52 pm
by Chris
Karl-Heinz wrote:
Is it also possible to override "ES_UPPERCASE" resource?
Hi Dick,

yes, the style ES_UPPERCASE can be added or removed at runtime.

Code: Select all

<oSle>:SetStyle ( ES_UPPERCASE , <lSet> )
Regards
Karl-Heinz
Oh, nice! I was certain that this actually doesn't work at runtime, but tested it and it indeed does!

Change SLE Resouce settings realtime

Posted: Wed Feb 19, 2020 7:17 pm
by ic2
Hello Karl-Heinz,

Thank you!

if (lUserWantsCityNotCapitalized)
SELF:oDCmCITY:SetStyle(ES_UPPERCASE,FALSE)
endif

works as I want it.
And besides, you have even taught the Master himself something new ;)

Dick

Change SLE Resouce settings realtime

Posted: Wed Feb 19, 2020 7:52 pm
by Chris
Hehe, ok but seriously if there's one master at least in this area, it's Karl-Heinz. I remember some 20 years ago when I was mostly lurking in the clcvo newsgroup and he was replying to EVERY single question regarding the Win32 API and always in a correct way of course and I was wondering how on earth he knew ALL that stuff!

That's when I decided to do A LOT of reading and try to reach a similar level myself, thinking that it would be helpful in the future. Well, it worked, I learned a lot and it did end up being very helpful :), but of course he will always be one step ahead!

Change SLE Resouce settings realtime

Posted: Wed Feb 19, 2020 9:11 pm
by Karl-Heinz
Part of the work is to find - and remembering of course ;-) - the places where help is provided.

e.g. https://docs.microsoft.com/en-us/window ... rol-styles ;-)

And come on Chris. What you and the Dev Team are doing day by day is incredible and incomparable. In Arnie´s words: You are the true action heroes, the true commandos and predators :-)

regards
Karl-Heinz

Change SLE Resouce settings realtime

Posted: Wed Feb 19, 2020 10:26 pm
by Chris
Karl-Heinz wrote:Part of the work is to find - and remembering of course ;-) - the places where help is provided.

e.g. https://docs.microsoft.com/en-us/window ... rol-styles ;-)
Indeed! And thanks for posting this, reading it I now understand why I had trouble in the past with the ES_READONLY property, could not change it at runtime and assumed the same would be true for ES_UPPERCASE and other as well.

But the topic above points out that in order to change it, you need to use the EM_SETREADONLY message, instead of changing ES_READONLY directly... Oh well, very glad that in Windows Forms those aspects are being handled much better and in a universal way!

Change SLE Resouce settings realtime

Posted: Thu Feb 20, 2020 4:53 am
by wriedmann
I could not agree more:
@Chris @Fabrice @Nikos @Robert
What you and the Dev Team are doing day by day is incredible and incomparable.
Wolfgang
(the names are alfabetical order).

Change SLE Resouce settings realtime

Posted: Thu Dec 31, 2020 11:41 am
by Alf
Hello to all,
my Intention is, changing controls to readonly (and also to readwrite) at runtime, but keeps the value in black color (NOT changing to lightgrey).

Need help: Can anybody teach my the correct syntax in X#:
SendMessage(self:oDCmLASTNAME:handle(), EM_SETREADONLY, ??????)

Regards
Alf