Sign in to follow this  
Followers 0
Vindicator209

Transparent Edit Box?

13 posts in this topic

How do you get an image background behing an edit box?

I tried GuiCtrlSetBkColor($GUI_BKCOLOR_TRANSPARENT) but then realized that only works on labels, then I tried GuiCtrlSetImage() which also didnt work.

Its not greatly important to my script but it would help making it look more professional, u know?

Thanks, MethodZero


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

You could use GUICtrlCreatePic() to lay an image over the edit control, but as soon as you start typing, that line will revert to the standard edit control background. In a multiline edit control this can be interesting, but not really very professional..

$gui = GUICreate("My GUI", 210, 210)
$edit = GUICtrlCreateEdit("", 5, 5, 200, 200, BitOr($ES_MULTILINE, $ES_WANTRETURN))
$pic = GUICtrlCreatePic("gary.png", 5, 5, 200, 200)

I'm just suscribing so that I can find out if anyone else knows how to do it; I can think of some good applications of this capability.

;o)

(or


nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Not exactly the effect I wanted, but I can work with it, thanks, im still open for more suggestions though

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

No problem! :)

;o)

(or

[edit: argh! you edited your post! what happened to all the brilliant wonderful magic stuff? did you try to actually input some text? hehe]

Edited by corz

nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

haha sorry, it was brilliant actually, I edited it out so it wouldnt seem like I resolved it and dont need help, it of course helped, infact even when you type thers no problem, just when you highlight stff then it goes white, hehe

Infact, I'l use your method until somone does have a solution to this

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

Good thinking! I'm keen to see other methods, myself.

Anyone?

;o)

(or


nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites

Hi,

another dodgey fidgity work around to having the edit transparent and having the main gui solid.

here

The example is with an input box , but could be done with any control...

Basically just add a pic to the main gui and it'll show through the transparent edit box.

Share this post


Link to post
Share on other sites

Not sure if this is what you mean but I've used it before. In my custom GUI's I set the background images using GuictrlSetState(-1, $GUI_DISABLE) (where the -1 refers to the picture).


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

You can do this, which doesn't completely work but it's close. It's copied from the forum somewhere and I just added a pic behind the edit.

#include <GUIConstants.au3>

$main = GUICreate('Transparency', 200, 55, -1, -1, -1, $WS_EX_TOPMOST)
$n=GUICtrlCreatePic(@Systemdir & "\oobe\images\mslogo.jpg",5,5, 190,20)
GuictrlSetState(-1, $GUI_DISABLE)

$Slider = GuiCtrlCreateSlider(5, 30, 190, 20,$TBS_NOTICKS + $TBS_BOTH)
GUICtrlSetLimit($Slider, 255, 1)
GUICtrlSetData($Slider, 255)
GUISetState()

$Child = GUICreate('Input', 188, 18, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, $main)
$Input = GUICtrlCreateInput('Use slider to set transparency', -1, -1, 190, 20)
GUISetState()

$old = GUICtrlRead($Slider)

While 1
    $wpm = WinGetPos($main)
    $x = $wpm[0] + 9
    $y = $wpm[1] + 35
    WinMove($Child, "", $x, $y)
    If GUICtrlRead($Slider) <> $old Then
        WinSetTrans($Child, "", GUICtrlRead($Slider))
        $old = GUICtrlRead($Slider)
    EndIf   
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

:)

That "somewhere" being, by an amazing coincedence, the post in smashly's link, two posts up!

We're getting closer, though.

;o)

(or


nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites

:)

That "somewhere" being, by an amazing coincedence, the post in smashly's link, two posts up!

We're getting closer, though.

;o)

(or

Surely I'm not expected to remember what happened more than one post ago? ;)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I love that about this forum, you can follow a train of suggestions and threads, until you eventually end up back to the first post! :)

I couldn't miss the opportunity to point that out, yer a good sport!

;o)

(or


nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Well, the only problem with that is when you MOVE the window, then the child doesnt move until you stop moving the parent... its a bit hard to mess with... espcecially when you've already written your script

ALSO, This is a bit of a problem too, because not only the input box is transparent, but also the text, I want my edit box to look as if your writing over an image instead of the plain white background

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

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