Sign in to follow this  
Followers 0
layer

GUICtrlSetStyle isnt working?

7 posts in this topic

im doing some work on my HTML code generator and im doing the hard code editing (where the edit becomes NON readonly) and heres what ive got, and tried but doesnt work

Func _SetHardCodeStyle()
    If GUICtrlRead($hardcode) = $GUI_CHECKED then
        GUICtrlSetStyle($output, -1)
    Else
        GUICtrlSetStyle($output, $ES_READONLY)
    EndIf
EndFunc

yes yes, the variables are declared, so basically, if the checkbox is checked, and the button (not in this code) is pressed, then set the main edit control ($output) to default styles, and NOT readonly.. else, just make it read only.. and yes, ive tried putting a msgbox where GUICtrlSetStyle is and the msgbox appears, so everything is working except for this.. and heres the othetr thing i tried:

Func _SetHardCodeStyle()
    If GUICtrlRead($hardcode) = $GUI_CHECKED then
        GUICtrlSetStyle($output, NOT $ES_READONLY)
    Else
        GUICtrlSetStyle($output, $ES_READONLY)
    EndIf
EndFunc

Any suggestions... :)

thanks :D


FootbaG

Share this post


Link to post
Share on other sites



*bumpzorz* :)


FootbaG

Share this post


Link to post
Share on other sites

If GUICtrlRead($checkCN) = $GUI_CHECKED then
   GUICtrlSetStyle($output, $WS_DISABLED)
Else
   GUICtrlSetStyle($output, $GUI_ENABLE)
EndIf

That sorta works. I tested that on an Inputbox, which I am assuming $output is. The only problem is that when the Check box is checked and $WS_DISABLED is active you cant highlight whats in the inputbox.


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

wtfeck is $WS_ENABLED and $WS_DISABLED?? those arent even in GUIConstants.au3... obviously then you didnt check it, unless im missing something in my include?? i tried $GUI_ENABLE, and that doesnt work either...


FootbaG

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I didn't say anything about $WS_ENABLED, and yes I did check it...

$WS_DISABLED 0x08000000 Creates a window that is initially disabled.

Why dont you open up the GUI Control Styles Tab....

Edit: I suppose you could do something abit... messy and create a new one each time

$check = 1

If GUICtrlRead($checkCN) = $GUI_CHECKED then
   If $check <> 0 Then
      GUICtrlDelete ($output)
      $OutPut = GUICtrlCreateInput ( "text", left, top -1, -1)
      $check = 0
   EndIf
Else
   If $check <> 1 Then
      GUICtrlDelete ($output)
      $OutPut = GUICtrlCreateInput ( "text", left, top -1, -1, $ES_READONLY)
      $check = 1
   EndIf
EndIf
Edited by Burrup

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

I don't think its terribly unreasonable for a user who is having problems with a style to consult the authoritative resource for Windows programming: MSDN. Spending about 5 seconds looking up the style ES_READONLY yielded me this information:

ES_READONLY

Prevents the user from typing or editing text in the edit control.

To change this style after the control has been created, use the EM_SETREADONLY message.

Share this post


Link to post
Share on other sites

thanks.. works perfect :)


FootbaG

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0