Jump to content

No cursor in edit?


Recommended Posts

Hi!

1. I have an edit control, in which I only show some texts. I make it READONLY, which is great, but I would like to remove the blinking cursor from there, from the edit control. Is it possible? Maybe even to be impossible to mark the text.

Specification: do not recomment me a label control, since I need to put text in a specific area, using scroll if the text is too long. So I really need the edit control, but with no cursor.

2. Also, is possible to have only a control with transparency? I think it's a stupid question :( . Is possible the background of the edit not to be a colour, but to see the pict background I use for all main window?

(Since no answer yet, I add a 3rd question; last question?) 3. The final compiled program (with SciTe) makes an icon in systray, with "Script Paused" and "Exit". Can I disable this somehow? In the final product, final executable program, I don't need that. What directive should I use?

Thanks in advance!

rkn

Edited by Radu Capan
Link to comment
Share on other sites

1. Its possible with the HideCaret() API call but I haven't much luck getting it to work correctly. Maybe ask the Larry, he's API pro.

2. Iv'e seen it done with VB but don't know if it's possible with Autoit. It would involve more API calls.

3. put this at the top of your program:

#NoTrayIcon
AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Link to comment
Share on other sites

#include <GUIConstants.au3>

$hGUI = GUICreate("test",200,200)
$hEdit  = GUICtrlCreateEdit("",0,0,200,200)
GUISetState()
DllCall("user32.dll","int","HideCaret","int",0)

While 1
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
Link to comment
Share on other sites

ok How about this?

#include <GUIConstants.au3>

$hGUI = GUICreate("test",200,220)
$hEdit  = GUICtrlCreateEdit("Text",0,0,200,200,$ES_READONLY)
GUICtrlSetState(-1,$GUI_DISABLE)
$hInput = GUICtrlCreateInput("",0,201,200,19)
ControlFocus($hGUI,"",$hInput)
GUISetState()
GUICtrlSetData($hEdit,"This is new data")

While 1
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
Link to comment
Share on other sites

Yeah but now it's disabled and the text can't be right-clicked/copied.

I would want it read only but no caret and text selectable/copyable

I thought of how to do it but it's rather clunky. I just would like to do it with just API calls if possible.

AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Link to comment
Share on other sites

1. I have an edit control, in which I only show some texts. I make it READONLY, which is great, but I would like to remove the blinking cursor from there, from the edit control. Is it possible? Maybe even to be impossible to mark the text.

:(
Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
Link to comment
Share on other sites

you can use this on as many controls as you need to.

just remember for each call to HideCaret there has to be a call to ShowCaret

Hiding is cumulative. If your application calls HideCaret five times in a row, it must also call ShowCaret five times before the caret is displayed.

DllCall("user32.dll","long","HideCaret","hwnd",$controlID)

DllCall("user32.dll","long","ShowCaret","hwnd",$controlID)
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I thank to all of you! The GUI_DISABLE solution made the edit grey, but the HideCaret solution did work! And also thanks for helping me to remove the tray icon.

T H A N K S. Great forum. Great help. Great people.

rkn

Link to comment
Share on other sites

Yay I got it to work! I forgot about GuiGetCursorInfo()

#include <GUIConstants.au3>

$hGUI = GUICreate("test",200,200)
$hEdit    = GUICtrlCreateEdit("",0,0,100,100)
GUICtrlCreateEdit("", 5, 120, 100, 40)
GUICtrlCreateButton("button", 150, 140)
GUISetState()

While 1
    $msg = GUIGetMsg()
    $info = GUIGetCursorInfo()
    if ($info[4] = $hEdit) and $info[2] then DllCall("user32.dll","int","HideCaret","int",0)

    if $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Edited by steveR
AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Link to comment
Share on other sites

  • 8 years later...

Hello,

i tried the snipplet from user GaryFrost, but didnt get to work it like i thougt. So i had to use the version from user Ejoc change it a little, and just want to ask if this is a "good" way, because i hat to put the API call into the "Listener", the "endless loop"

#include <GUIConstants.au3>

$hGUI = GUICreate("test",400,200, -1, 200, $WS_SIZEBOX +  $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX)

$hEdit  = GUICtrlCreateEdit("",20,20,200,100, $WS_HSCROLL + $WS_VSCROLL + $ES_READONLY)

$hButton  = GUICtrlCreateButton("Click me!", 250, 50, 70, 30)

GUISetState()

While 1
    
    ;$info = GUIGetCursorInfo()
    ;if ($info[4] = $hEdit) and $info[2] then DllCall("user32.dll","int","HideCaret","int",0)
    DllCall("user32.dll","int","HideCaret","int",0)

    $msg = GUIGetMsg()

    if $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf

    if $msg = $hButton Then
        GUICtrlSetData($hEdit, "Thank you!" & @CRLF & @CRLF)
    EndIf
WEnd

Thanks a lot!

Juergen

Edited by hausl78
Link to comment
Share on other sites

  • Moderators

hausl78,

You do realise that the post above yours dates from nearly 9 years ago? Ejoc has not been online for 6 years and GaryFrost is not a frequent visitor. :o

In future please do not resurrect threads from this far back - the language has changed so much that it is likely that the functionality has already been incorporated and the previously posted code will almost certainly not run in the current version of AutoIt without modification. Just open a new thread and ask your question there. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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