Jump to content

img in edit?


Recommended Posts

how to load an image into a text edit?

as escroll is configured to remain at the bottom, to insert text?

#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_test()
Func _test()
    Local $var = ' <img border="0" src="' & @ScriptDir & '\img\' & '4' & '.gif" height="8"> '
    Local $hEdit, $hGUI

    $hGUI = GUICreate("edit test", 400, 200)
    $hEdit = GUICtrlCreateEdit("", 2, 2, 394, 195, BitOR($ES_WANTRETURN, $WS_VSCROLL))
    GUISetState()

    Do
        Sleep(1000)
        _GUICtrlEdit_InsertText($hEdit, @SEC & $var & @CRLF, 0)

    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_test
Link to comment
Share on other sites

  • Moderators

adrmil,

Welcome to the AutoIt forum. :P

how to load an image into a text edit

You answer your own question - why do you think you could put an image into a text edit? As far as I know there is no way to get images into a simple edit control, nor into a richtext one either. The controls are designed to edit text, as their name suggests.

What exactly are you trying to do? We might be able to suggest something else. :party:

as escroll is configured to remain at the bottom, to insert text?

I am afraid I do not understand what you mean here. Your _GUICtrlEdit_InsertText($hEdit, @SEC & @CRLF, 0) line (removing the image variable) inserts text perfectly at the top of the edit. :mellow:

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

as text but in html format or something, to load an emoticon :mellow:

this code is somewhat illogical but it is to ask, I can insertat dynamic images and text but separately. pictures with "GUICtrlSetImage" or "GUICtrlCreatePic" and text in a different control. No way to upload it as Rich Text? html or any different to plain text?

Link to comment
Share on other sites

resolved that the scroll will remain in the bottom :P

#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>

Opt('MustDeclareVars', 1)

test2()
Func test2()
    Local $win, $txt
    Local $msg, $read, $sec, $user
    TCPStartup()
    $win = GUICreate(@UserName, 400, 200)
    $txt = _GUICtrlEdit_Create($win, "", 0, 2, 400, 200)
    $user = @UserName
    GUISetState()
    While 1
        $sec = @SEC
        Sleep(1000)
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        If _GUICtrlEdit_GetText($txt) <> "" Then
            _GUICtrlEdit_SetText($txt, _GUICtrlEdit_GetText($txt) & @CRLF & $read)
        Else
            _GUICtrlEdit_SetText($txt, _GUICtrlEdit_GetText($txt) & $read)
        EndIf
        If _GUICtrlEdit_GetText($txt) <> "" Then
            _GUICtrlEdit_SetText($txt, _GUICtrlEdit_GetText($txt) & @CRLF & $user & " -> " & $sec)
        Else
            _GUICtrlEdit_SetText($txt, _GUICtrlEdit_GetText($txt) & $user & " -> " & $sec)
        EndIf
        GUICtrlSetData($sec, "")
        _GUICtrlEdit_LineScroll($txt, _GUICtrlEdit_GetLineCount($txt) + 1, _GUICtrlEdit_GetLineCount($txt) + 1)
    WEnd
    Exit
EndFunc   ;==>test2

I keep trying but not know how to display an image next to the text :mellow:

Edited by adrmil
Link to comment
Share on other sites

As previously stated, you could just use an IE object in your app to accomplish a mix of all sorts of multimedia and text.

Here is a small example:

#include <IE.au3>
#include <GUIConstantsEx.au3>

_IEErrorHandlerRegister ()
$GUI = GUICreate("App", 500, 500, @DesktopWidth / 2)
$oIE = _IECreateEmbedded()
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 10, 480, 480)
_IENavigate($oIE, 'about:blank')
_IEBodyWriteHTML($oIE, 'some text here, and a smiley <img src="http://memeart.tripod.com/smiley2.gif"> inbetween it.')
GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    Sleep(10)
WEnd
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...