Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

Change SLE Resouce settings realtime 18 Feb 2020 00:30 #13294

  • ic2
  • ic2's Avatar
  • Topic Author


  • Posts: 1573
  • 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

    Please Log in or Create an account to join the conversation.

    Change SLE Resouce settings realtime 18 Feb 2020 00:38 #13295

    • Chris
    • Chris's Avatar


  • Posts: 3739
  • 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?
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Change SLE Resouce settings realtime 18 Feb 2020 12:22 #13302

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Is it also possible to override "ES_UPPERCASE" resource?

    Hi Dick,

    yes, the style ES_UPPERCASE can be added or removed at runtime.
    <oSle>:SetStyle ( ES_UPPERCASE , <lSet> )
    Regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    Change SLE Resouce settings realtime 18 Feb 2020 17:52 #13308

    • Chris
    • Chris's Avatar


  • Posts: 3739
  • 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.
    <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!
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Change SLE Resouce settings realtime 19 Feb 2020 20:17 #13326

    • ic2
    • ic2's Avatar
    • Topic Author


  • Posts: 1573
  • 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

    Please Log in or Create an account to join the conversation.

    Change SLE Resouce settings realtime 19 Feb 2020 20:52 #13327

    • Chris
    • Chris's Avatar


  • Posts: 3739
  • 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!
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Change SLE Resouce settings realtime 19 Feb 2020 22:11 #13328

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Part of the work is to find - and remembering of course ;-) - the places where help is provided.

    e.g. docs.microsoft.com/en-us/windows/win32/c.../edit-control-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

    Please Log in or Create an account to join the conversation.

    Change SLE Resouce settings realtime 19 Feb 2020 23:26 #13329

    • Chris
    • Chris's Avatar


  • Posts: 3739
  • Karl-Heinz wrote: Part of the work is to find - and remembering of course ;-) - the places where help is provided.

    e.g. docs.microsoft.com/en-us/windows/win32/c.../edit-control-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!
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Change SLE Resouce settings realtime 20 Feb 2020 05:53 #13330

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3244
  • 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).
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Change SLE Resouce settings realtime 31 Dec 2020 12:41 #17031

    • Alf
    • Alf's Avatar


  • Posts: 52
  • 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

    Please Log in or Create an account to join the conversation.

    Change SLE Resouce settings realtime 31 Dec 2020 14:40 #17032

    • robert
    • robert's Avatar


  • Posts: 3276
  • Alf,
    SendMessage(self:oDCmLASTNAME:handle(), EM_SETREADONLY, 1,0 ) // to enable readonly

    SendMessage(self:oDCmLASTNAME:handle(), EM_SETREADONLY, 0,0 ) // to make read/write

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    Change SLE Resouce settings realtime 01 Jan 2021 19:34 #17035

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Hi Alf,

    to set the desired colors you might overwrite the ReadOnly assign. But it doesn´t make sence to create new objects each time the assign is triggered. So you should implement a global system where the required colors and brushes are created only once.

    CLASS MySle INHERIT SingleLineEdit 
    	
    ASSIGN ReadOnly(lNewValue) CLASS MySle
    	
        SUPER:ReadOnly := lNewValue               
    	
    	IF lNewValue
    		SELF:Background := Brush { Color { GetSysColor ( COLOR_BTNFACE ) } } 
    		SELF:TextColor := Color { GetSysColor ( COLOR_WINDOWTEXT ) } 
    	ELSE 
    		SELF:Background := Brush { Color { GetSysColor ( COLOR_WINDOW ) } } 
    		SELF:TextColor := Color { GetSysColor ( COLOR_WINDOWTEXT ) } 
    	ENDIF 
    	
    	RETURN 	

    BTW: Are you the real Alf ?

    Alf - "Can I use the microwave?"
    Kate Tanner(Mom) - "Why?"
    Alf - "Because the cat doesn't fit in the toaster."

    SCNR ;-)

    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    Change SLE Resouce settings realtime 02 Jan 2021 13:55 #17038

    • Alf
    • Alf's Avatar


  • Posts: 52
  • Hi Karl-Heinz,
    thanks. This works perfect.

    <<<BTW: Are you the real Alf ?>>>
    Yes, my name is really Alf. But I never put my cat in a microwave (only the barking dogs of my neighbors).

    regards
    Alf

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1