Jump to content

GUI EditBox


Recommended Posts

how can i make the edit box appear enabled if it's disabled so you can copy text from it but not delete text from it

Either it is enabled or disabled!

However, you mean this:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Test", 315, 196, 192, 124)
$Edit = GUICtrlCreateEdit("", 0, 0, 313, 193, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY))
GUICtrlSetData(-1, "This is a text")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Edit
    EndSwitch
WEnd

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

i don´t know why but readonly never works for me.. :S same as change text color to radios checkboxes and groups... :S ¿¿are that bugs?? sorry if this is not the section, but i know few english and i don´t understand how to report these bugs...

win7 64bits.. vesion of autoit 3.3.6.1

Link to comment
Share on other sites

The help file often explains the non-bugs. If you read the page GUICtrlSetColor() you should find this

Only Button, Label, Checkbox, Group, Radio, Edit, Input, List, Listview, ListviewItem, Treeview, TreeviewItem, Graphic, Progress and Combo controls can currently be colored.

Checkbox, Radio, Group or Progress controls cannot be painted if the "Windows XP/Vista style" is used.

Button controls are always painted in "Windows Classic style".

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

There is a way to recolor those on a GUI even if there is a theme selected on the computer. Here's a slightly modified example that Guiness posted The part that does the magic is in the _SetWindowTheme function. You will be able to see the difference in the the 2 checkboxes if you run the example, the first one has colored text on the check box, the other has the default text color.

#include <Array.au3>
Global $Example
Global $GUI = GUICreate("GUI")
Global $Button_Theme = GUICtrlCreateCheckbox("Theme", 10, 10, 80, 30)
_SetWindowTheme(-1)
GUICtrlSetColor(-1, "0xff0000")
GUICtrlSetBkColor(-1, "0x00FF00")
Global $Button_NoTheme = GUICtrlCreateCheckbox("NoTheme", 95, 10, 80, 30)
GUICtrlSetColor(-1, "0xff0000")
GUICtrlSetBkColor(-1, "0x00FF00")
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $Button_Theme
            $Example = _GetWindowTheme($Button_Theme)
            _ArrayDisplay($Example, "0 = Theme & 1 = Handle") ; This is how is should be from what I can gather.
        Case $Button_NoTheme
            $Example = _GetWindowTheme($Button_NoTheme)
            _ArrayDisplay($Example, "0 = Theme & 1 = Handle") ; This is how is should be from what I can gather.
    EndSwitch
WEnd

Func _GetWindowTheme($hHandle = -1)
    Local $aReturn = DllCall("UxTheme.dll", "int", "GetWindowTheme", "hwnd", GUICtrlGetHandle($hHandle))
    If @error Then Return SetError(1, 1, 0)
    Return $aReturn
EndFunc   ;==>_GetWindowTheme

Func _SetWindowTheme($hHandle = -1) ; Taken from the Forums but available in WinAPIEx.au3 too.
    Local $aReturn = DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($hHandle), "wstr", 0, "wstr", 0)
    If @error Then Return SetError(1, 1, 0)
    Return $aReturn[0]
EndFunc   ;==>_SetWindowTheme

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

There is a way to recolor those on a GUI even if there is a theme selected on the computer. Here's a slightly modified example that Guiness posted The part that does the magic is in the _SetWindowTheme function. You will be able to see the difference in the the 2 checkboxes if you run the example, the first one has colored text on the check box, the other has the default text color.

Thanks a lot for the answer. This is very useful to me

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...