Sign in to follow this  
Followers 0
Kraven

Input over Image

6 posts in this topic

Hi, how can I put an input text over a picture and make input clickable?

$dd = GUICtrlCreatePic(@ScriptDir & "\image.jpg", 0, 0, 800, 800)
$var = GUICtrlCreateInput ("Text", 40, 4, 120, 18)

The display is not exactly the best, how can I fix this?

Thanks to all, sorry my bad english.

Share this post


Link to post
Share on other sites



What do you mean with "input clickable"?

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

_GDIPlus_Startup ()

Local $n, $msg
$pic = "c:\Program Files\AutoIt3\Examples\GUI\mslogo.jpg"
$hImgage = _GDIPlus_ImageLoadFromFile($pic)
$iX = _GDIPlus_ImageGetWidth($hImgage)
$iY = _GDIPlus_ImageGetHeight($hImgage)
_GDIPlus_ImageDispose($hImgage)
GUICreate("My GUI picture", $iX * 2, $iY * 2) ; will create a dialog box that when displayed is centered

GUISetBkColor(0xE0FFFF)
$n = GUICtrlCreatePic($pic, 0, 0, $iX * 2, $iY * 2)
$input = GUICtrlCreateInput("", 50, 10, $iX / 2, 20)

GUISetState()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
_GDIPlus_ShutDown ()
Exit

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

I changed in this way:

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

_GDIPlus_Startup ()

Local $n, $msg
$pic = "C:\image.jpg"
$hImgage = _GDIPlus_ImageLoadFromFile($pic)
$iX = _GDIPlus_ImageGetWidth($hImgage)
$iY = _GDIPlus_ImageGetHeight($hImgage)
_GDIPlus_ImageDispose($hImgage)
GUICreate("My GUI picture", 579, 800) ; will create a dialog box that when displayed is centered

GUISetBkColor(0xE0FFFF)
$n = GUICtrlCreatePic($pic, 0, 0, 579, 800)
$input = GUICtrlCreateInput("", 50, 10, $iX / 2, 20)

GUISetState()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
_GDIPlus_ShutDown ()
Exit

The input is created but the text inside is not selectable, creating another input could only move tabs.

How can I make the text in the input selectable with the mouse?

Thanks ;)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Perhaps he want a pic with a link when click on it... Posted Image

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

_GDIPlus_Startup ()
Local $n, $msg
$pic = @ProgramFilesDir & '\AutoIt3\Examples\GUI\mslogo.jpg'
$hImgage = _GDIPlus_ImageLoadFromFile($pic)
$iX = _GDIPlus_ImageGetWidth($hImgage)
$iY = _GDIPlus_ImageGetHeight($hImgage)
_GDIPlus_ImageDispose($hImgage)
GUICreate("My Pic Link", $iX, $iY*2) ; will create a dialog box that when displayed is centered
GUISetBkColor(0xE0FFFF)
$_Pic = GUICtrlCreatePic ( "C:\Program Files\AutoIt3\Examples\GUI\logo4.gif", 0, 0, $iX, $iY*2)
GUICtrlSetTip ( -1, "Click on me !" ) 
GUISetState()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg ( )
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $_Pic
            ShellExecute ( "http://www.autoitscript.com" )
    EndSwitch
    Sleep ( 20 )
WEnd

_GDIPlus_ShutDown ( )
Exit
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I assume he wants to mark the input text and copy it with ctrl-c!

Here the code for it

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

_GDIPlus_Startup ()

Local $n, $msg
$pic = "c:\Program Files\AutoIt3\Examples\GUI\mslogo.jpg"
$hImgage = _GDIPlus_ImageLoadFromFile($pic)
$iX = _GDIPlus_ImageGetWidth($hImgage)
$iY = _GDIPlus_ImageGetHeight($hImgage)
_GDIPlus_ImageDispose($hImgage)
$hGUI = GUICreate("My GUI picture", $iX * 2, $iY * 2) ; will create a dialog box that when displayed is centered

GUISetBkColor(0xE0FFFF)
$n = GUICtrlCreatePic($pic, 0, 0, $iX * 2, $iY * 2)
GUICtrlSetState(-1, $GUI_DISABLE)

$input = GUICtrlCreateInput("", 50, 10, $iX / 2, 20)
GUISetState()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
_GDIPlus_ShutDown ()
Exit

The trick is to add the line GUICtrlSetState(-1, $GUI_DISABLE) just after $n = GUICtrlCreatePic($pic, 0, 0, $iX * 2, $iY * 2).

Br,

UEZ

Edited by 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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Perfect, thanks for the help, I learned something new ;)

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