Jump to content
Sign in to follow this  
zvvyt

Parent GUI w/ backgroundimage and transparent child GUI ontop?

Recommended Posts

zvvyt

Hello there!

The idea I'm having is the following:

To have a GUI with the left half scrollable and to have a background image which is "fixed" and won't be moved with the scrolling.

To do this I've so far come up with:

Placing the backgrond image onto a parent GUI

Creating a child GUI to the parent, ontop of the left half of the parent

Using "GUIScrollbars_Ex.au3" to easy insert my scrollbars into the child gui

The problem I'm having is that the background image places itself ontop of the child GUI, making the child not visible.

I have tried placing the same background image into the child GUI to recieve the same result I want, but by doing so the image will move with my scrolling. (The right half of the parent is covered by another image, so that's why I'm able of placing the same background image into the child GUI)

If I'm somehow able of placing the background image "behind" the child GUI I could use either a transparent .GIF or .PNG to make the child window show the image aswell as my controls.

Any direct thoughts about this, or do you need me to post some of the code?

Best regards,

Share this post


Link to post
Share on other sites
Melba23

zvvyt,

do you need me to post some of the code?

Yes please - then we will see exactly what you have done so far. ;)

M23

P.S. When you post your code please use Code tags - put [autoit] before and [/autoit] after it. :)


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
zvvyt

Alrighty then! ^__^

I took only the parts about GUIs and their controls now, which I recon are what matters.

#include <ButtonConstants.au3>
#include "GUIScrollbars_Ex.au3"





$MainWindow = GUICreate("Main Window", 800,500,-1,-1,-1)
;$ItemBackground = GUICtrlCreatePic(".\..\LoL Recommended Builder\ItemsBackground.jpg",0,0,900,600,$bs_flat) ;--------Here's the background image stated in my last post
GUICtrlSetState($ItemBackground,$gui_disable)
$Border = GUICtrlCreatePic(".\..\LoL Recommended Builder\Images\Layout\Border.jpg",802-260*(500/390)-38,0,38,500,$bs_flat)
$ChampionSplash = GUICtrlCreatePic("",802-260*(500/390),"",260*(500/390),390*(500/390),$BS_FLAT)
$ButtonCC = GUICtrlCreateButton("Change Champion",700,0,95,25,$GUI_NOFOCUS)
$RecItem1 = GUICtrlCreateIcon("icons.dll","NOITEM",470,440,50,50)
$RecItem2 = GUICtrlCreateIcon("icons.dll","NOITEM",525,440,50,50)
$RecItem3 = GUICtrlCreateIcon("icons.dll","NOITEM",580,440,50,50)
$RecItem4 = GUICtrlCreateIcon("icons.dll","NOITEM",635,440,50,50)
$RecItem5 = GUICtrlCreateIcon("icons.dll","NOITEM",690,440,50,50)
$RecItem6 = GUICtrlCreateIcon("icons.dll","NOITEM",745,440,50,50)
$HighlightRecItem = GUICtrlCreateGroup("","","","","")
GUICtrlSetState(-1, $gui_hide)
$HighlightSelectedItem = GUICtrlCreateGroup("","","","","")
GUICtrlSetState(-1, $gui_hide)
$Read = FileReadLine("List.ini",2)
$ItemDropdown = GUICtrlCreateCombo("",50,50,200,45)
GUICtrlSetState(-1,$gui_hide) ;--------------------------------------------------------------------------------------------Temp. Hidden
GUICtrlSetData(-1,$Read)
$SelectedItem = GUICtrlCreateIcon("","",300,100,64,64)
$BackButton = GUICtrlCreatePic(".\..\LoL Recommended Builder\Images\Layout\Back.jpg",165,370,100,30) ;Back-button
GUICtrlSetState(-1,$gui_hide)
GUICtrlCreatePic(".\..\LoL Recommended Builder\Images\Layout\ItemTextBackgroundDark.jpg",0,400,430,100) ;Background for itemtext
$ItemText = GUICtrlCreateLabel("",10,410,420,80)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@sw_hide,$MainWindow)


;-----------------------------------------------------------------------------Child Windows----------------------
$CatWindow = GUICreate("Main Category Window",430,400,0,0,$ws_child,"",$MainWindow) ;First child-window with the main categories
;$ItemBackground = GUICtrlCreatePic(".\..\LoL Recommended Builder\ItemsBackground.jpg",0,0,900,600,$bs_flat);----And here is where I tried placing the background again.
$CatDefense = GUICtrlCreatePic(".\..\LoL Recommended Builder\Images\Layout\Cat.Defense.jpg",115,45,200,40)
$CatAttack = GUICtrlCreatePic(".\..\LoL Recommended Builder\Images\Layout\Cat.Attack.jpg",115,110,200,40)
$CatMagic = GUICtrlCreatePic(".\..\LoL Recommended Builder\Images\Layout\Cat.Magic.jpg",115,175,200,40)
$CatMovement = GUICtrlCreatePic(".\..\LoL Recommended Builder\Images\Layout\Cat.Movement.jpg",115,240,200,40)
$CatConsumables = GUICtrlCreatePic(".\..\LoL Recommended Builder\Images\Layout\Cat.Consumables.jpg",115,305,200,40)
GUISetState(@sw_hide,$CatWindow)

$CatWindowDefense = GUICreate("Defense",430,400,0,0,$ws_child,"",$MainWindow) ;A child-window showing the defense subcats
$DefenseSubcatHealth = GUICtrlCreatePic(".\..\LoL Recommended Builder\Images\Layout\SubCat.Health.jpg",115,45,200,40)
$DefenseSubcatMagicResist = GUICtrlCreatePic(".\..\LoL Recommended Builder\Images\Layout\Subcat.MagicResist.jpg",115,110,200,40)
$DefenseSubcatHealthRegen = GUICtrlCreatePic(".\..\LoL Recommended Builder\Images\Layout\Subcat.HealthRegen.jpg",115,175,200,40)
$DefenseSubcatArmor = GUICtrlCreatePic(".\..\LoL Recommended Builder\Images\Layout\Subcat.Armor.jpg",115,240,200,40)
GUISetState(@SW_HIDE)

Best regards

Share this post


Link to post
Share on other sites
Melba23

zvvyt,

That script looks very much as if it is game-related (League of Legends) - you have read the Forum Rules I take it? ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
zvvyt

That script looks very much as if it is game-related (League of Legends) - you have read the Forum Rules I take it? :)

It is correct, that game is made "for" League of Legends!

I dunno if you're a player yourself or not, but the meaning of this program is to make a visual solution for a function created by Riot games themselves.

I'll describe this in short:

Ingame each champion has got a "Recommended build", an item build that if you follow it you'll do "good" in game with that character.

There's a way of making your own "Recommended build" for whichever champion you'd like, but to do so you have to type all the specific item numbers and such into a .ini file, all this implemended by Riot Games.

It works outside of "LoL", so it's nothing really to do with the game itself, therefor I take it this is allowed to take up for discussion? ;)

More about this function can be read here: http://na.leagueoflegends.com/board/showthread.php?t=1177803 where their "tech support" explains how to do this yourself w/ the .ini and so ^__^

Best regards,

Share this post


Link to post
Share on other sites
Melba23

zvvyt,

I am not a gamer so I have no idea what you are talking about. I am locking this thread until I can find out more. Please accept my apologies in advance if this is an unnecessary precaution. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Valik

As long as this remains a purely GUI question I'm going to allow this. There's no manipulation of the game here. There's no manipulation of the INI file, either. As long as this discussion remains strictly on the GUI it's fine.

Share this post


Link to post
Share on other sites
PhoenixXL

You can create the ScrollBar this is the basic code

#include-once
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$hParent=GUICreate('',400,500)
GUICtrlCreatePic('Tc3.jpg',0,0 ,400,500)
GUICtrlSetState(-1,$GUI_DISABLE)
GUISetState(@SW_SHOW,$hParent)
$h_Child=GUICreate('',100,300,10,10,$WS_POPUP,$WS_EX_MDICHILD,$hParent)
GUISwitch($h_Child)
GUICtrlCreateEdit('',10,10,90,290)
GUISetState(@SW_SHOW,$h_Child)
Local $nMsg[1]
While $nMsg[0]<>-3
$nMsg=GUIGetMsg(1)
WEnd

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
zvvyt

First of all: Thank's for unlocking the thread! =)

You can create the ScrollBar this is the basic code

#include-once
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$hParent=GUICreate('',400,500)
GUICtrlCreatePic('Tc3.jpg',0,0 ,400,500)
GUICtrlSetState(-1,$GUI_DISABLE)
GUISetState(@SW_SHOW,$hParent)
$h_Child=GUICreate('',100,300,10,10,$WS_POPUP,$WS_EX_MDICHILD,$hParent)
GUISwitch($h_Child)
GUICtrlCreateEdit('',10,10,90,290)
GUISetState(@SW_SHOW,$h_Child)
Local $nMsg[1]
While $nMsg[0]<>-3
$nMsg=GUIGetMsg(1)
WEnd

By adding the $WS_POPUP,$WS_EX_MDICHILD to the child made it be ontop and in position, but it "flickers" a bit when it "popups". Is that avoidable? Or do I "have to live with it?"

And then to the child gui being transparent: Ain't that possible to achieve w/ GuiCtrlCreatePic and a transparent .GIF? Or do I need to use GDI+ and a transparent .png?

Share this post


Link to post
Share on other sites
PhoenixXL

Ain't that possible to achieve w/ GuiCtrlCreatePic and a transparent .GIF?

If u r dealing with GIF's then Tracexx UDF will sound helpful

herez the link :

but it "flickers" a bit when it "popups". Is that avoidable? Or do I "have to live with it?"

I dont see any flicker with my code

Regards

Phoenix XL


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
zvvyt

If u r dealing with GIF's then Tracexx UDF will sound helpful

herez the link :

Link seem to be broken, but found it by Google.

Can I recieve same transparent result with .GIF as with .PNG? First time dealing with this matter so I have no clue >__<

I dont see any flicker with my code

Could be becuase I'm having another GUI up before the parent and child one.

EDIT: Fixed by reorganizing the GuiSetState-commands

Best regards,

Edited by zvvyt

Share this post


Link to post
Share on other sites
martin

I haven't carefully read everything in this thread but I notice you keep referring to a transparent child. Transparent child windows are not so easy but you can do it in AutoIt if you have a child with the style $WS_EX_MDICHILD.

Here is a simple example

#include <windowsconstants.au3>
#include <winapi.au3>

$G1 = GUICreate("Parent")
GUICtrlCreateButton("quite a long button across the middle of the parent gui",20,200)
GUISetState()

$C1 = GUICreate("child",200,300,0,0,-1,bitor($WS_EX_MDICHILD, $WS_EX_LAYERED),$G1)
GUISetBkColor(0xacbdef);set the child background to some colour which we can set as the transparent colour
$btn1 = GUICtrlCreateButton("a button",20,50)
GUISetState()
_WINAPI_SetLayeredWindowAttributes($C1, 0xacbdef, 255)

sleep(9000)
  • Like 1

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
zvvyt

I haven't carefully read everything in this thread but I notice you keep referring to a transparent child. Transparent child windows are not so easy but you can do it in AutoIt if you have a child with the style $WS_EX_MDICHILD.

Here is a simple example

#include <windowsconstants.au3>
#include <winapi.au3>

$G1 = GUICreate("Parent")
GUICtrlCreateButton("quite a long button across the middle of the parent gui",20,200)
GUISetState()

$C1 = GUICreate("child",200,300,0,0,-1,bitor($WS_EX_MDICHILD, $WS_EX_LAYERED),$G1)
GUISetBkColor(0xacbdef);set the child background to some colour which we can set as the transparent colour
$btn1 = GUICtrlCreateButton("a button",20,50)
GUISetState()
_WINAPI_SetLayeredWindowAttributes($C1, 0xacbdef, 255)

sleep(9000)

Your code worked like a charm on the transparancy! =D

Now it's just that when I click on a picture control in the child gui, an earlier hidden window comes back visible ... Just by adding the

bitor($WS_EX_MDICHILD, $WS_EX_LAYERED

and

GUISetBkColor(0xacbdef) _WINAPI_SetLayeredWindowAttributes($C1, 0xacbdef, 255)

Feels quite strange for me that this could happen. Will have a deeper look into it tomorrow.

EDIT: By removing the style $ws_child and replace it with $ws_popup I got away from the problem where another window would pop up. Dunno how, dunno why. Could be that something collided when I used both $ws_child and $ws_ex_mdichild.

Thanks for all your help in this matter! =D Much appreciated!

Edited by zvvyt

Share this post


Link to post
Share on other sites
meows

Melba23

Melba23

Yes, me!

  • Posted Image
  • Moderators (Mod)
  • Posted Image
  • 11,757 posts
  • Gender:Not Telling
  • Location:Where never lark or even eagle flew

Posted Today, 03:50 AM

meows,

Regardless of whether you wrote the game or not, the Forum Rules prohibit the discussion of any script which interacts with or launches a game. Your script does exactly that and so is not permitted here - this thread is now locked. :naughty:

Please make sure your future posts are within the rules. :)

M23

This is not fair. I got locked for asking how to make a graphic buttom user clickable and I built the game. Some folks have friends in higher places than I do.

But thanks for the questions and answers. I learned a bit.

Share this post


Link to post
Share on other sites
Melba23

meows,

This script did not interact with the game in any way as Valik makes quite clear:

There's no manipulation of the game here. There's no manipulation of the INI file, either

Your script by your own admission launches the game - which is prohibited under the Forum rules

Case $Icon1
        $Icon1= ShellExecuteWait("C:0aTestlvl3.exe", "","C:0aTest", "")
        ShellExecuteWait("C:0aTestChina2a.exe", "","C:0aTest", "")
EndSelect

That is the difference and that is why your thread was locked. :naughty:

And posting in another thread like this is not the way to make me change my mind. I will consider what to do with you during my drive home. :mad:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Melba23

meows,

I have now returned home, eaten and deliberated as to what I am going to do.

I have always made it clear that if I lock a thread I am quite prepared to listen to reasoned argument as to why I should not have done so. On several occasions - and this thread is a good case in point - the thread has indeed been reopened. But I will only reopen a thread if the OP can convince me that there is good reason to do so. In the thread to which you are referring you made it quite clear that the script was to launch a game - which is quite clearly prohibited under the Forum Rules. As I pointed out in the thread, it does not matter: if you wrote the game; if it is single player; if it is for your use only - the rules are quite clear:

"Do not discuss any of the following:

Automating games or game servers. This rule is zero tolerance. Any discussion of using AutoIt to launch or interact with a game or game server violates our rules"

As I stated in my earlier post, the script in this thread does not interact with the game while your script does - hence the difference in moderation. :mellow:

But you, instead of arguing reasonably, decide on an imflammatory post suggesting that there is favouritism and corruption with in the ranks of the Moderators. While I was quite prepared to let your initial thread pass by without imposing sanctions, I am not prepared to stand by while you attack the honour and integrity of those volunteers who give up their time to keep this forum the sort of place the majority of members wish it to be. If you cannot abide by the rules as set out by the forum owner and argue against those who enforce them - in as just a manner as they can - then you obviously forfeit your right to use the forum. :mad:

You will be unable to post for a month. When and if you return, either abide by the rules and show respect for those whose task it is to apply them or you will find yourself permanently removed. You have used up any shred of flexibility that I may have been prepared to show you - any attempt to PM me about this will result in an immediate block. :naughty:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

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  

  • Similar Content

    • nacerbaaziz
      By nacerbaaziz
      Hello my friends
      I have an inquiry and I hope to find the answer here
      I want to create a graphical user interface
      but I want to hide the system menu
      I mean the window menu
      Is this possible?
      If is possible please give me how to do that
      Thanks in advance
    • helmar
      By helmar
      I was playing around with simple GUI creation.  I tend to like parameter driven coding (in prior life (years ago) as Clipper/FoxPro/dBase coder).  Just wanted to see what I could do with a GUI.
      #Region options, includes Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) ; Change to OnEvent mode #include <GUIConstantsEx.au3> #EndRegion options, includes Global Const $nCols = 2, $nRows = 6, $nSpacer = 10, $nBtnWidth = 150, $nBtnHeight = 30 Global $xName = 0, $xID = 0 Global $nGUIWidth = ($nCols * $nBtnWidth) + (($nCols + 1) * $nSpacer) Global $nGUIHeight = ($nRows * $nBtnHeight) + (($nRows + 1) * $nSpacer) Global $hMainGUI = GUICreate("Calculated GUI", $nGUIWidth, $nGUIHeight, -1, -1) For $xRows = 1 to $nRows ;in this arrangement, tabbing is left to right, then next row For $xCols = 1 to $nCols ;reverse the order of this line with the prior line for top to bottom tabbing, then next col $xName += 1 $xID += 1 Global $Dummy = GUICtrlCreateButton("Button" & $xName, _ ($nBtnWidth * ($xCols - 1)) + (($xCols - 1) * $nSpacer) + $nSpacer, _ ($nBtnHeight* ($xRows - 1)) + (($xRows - 1) * $nSpacer) + $nSpacer, _ $nBtnWidth, _ $nBtnHeight) GUICtrlSetOnEvent($xID+2, "Handler") Next Next GUISetOnEvent($GUI_EVENT_CLOSE, "CloseApp") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func CloseApp() Exit EndFunc Func Handler() MsgBox(0,0,"Button " & @GUI_CtrlId - 2) EndFunc  
    • aiter
      By aiter
      I am trying to get an image showing through a edit box.  I am only successful in making the edit box totally transparent
      #include-once #include <GUIConstants.au3> #include <GDIPlus.au3> #include <WinAPISys.au3> #include <colorconstants.au3> ;WS_EX_TRANSPARENT $gui = GUICreate("", 1000, 800, -1, -1, -1 , $WS_EX_LAYERED) ; use layered to get _winapi_setlay... to work $pic = GUICtrlCreatePic("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif", 0,0,1000, 800) GUICtrlSetState(-1, $GUI_DISABLE) $edit = GUICtrlCreateEdit("First line" & @CRLF, 176, 32,200,600) GUICtrlSetBkColor(-1,$COLOR_YELLOW) _WinAPI_SetLayeredWindowAttributes($gui,$COLOR_YELLOW,199) ; 199 is alpha (transparency level) GUISetState(@SW_SHOW,$gui) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd Exit Func Terminate() exit(0) EndFunc So I am making the edit box's background yellow then using the _WINAPI_SetLayeredWIndowAttributes command to make the yellow disappear (which it does), but the alpha level is supposed to give a bit of opaqueness to it, but its not, just making it totally transparent.  The alpha level is in fact affecting the window itself and not the edit box. I only want the edit box to be partially transparent.
      Help appreciated.
       
    • ISI360
      By ISI360
      Hi!
      I am searching for a way to display a transparent image (or Icon) over an Button. And the image should always stay on top.

      Here is what i have so far:
      At script start the picture is over the button..but if you move the mouse over the button it overlaps the image.
      And if i add $GUI_ONTOP to the picture, the transparency is gone

      Maybe someone has an idea..

      Thanks in advance!
       
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPIIcons.au3> #include <WinAPIShellEx.au3> GUICreate("GUI", 300, 300) $hbutton = GUICtrlCreateButton("This is a button", 20, 40, 150, 30,$WS_CLIPSIBLINGS) $hpic = GUICtrlCreatePic("", 10, 10, 128, 128) _SetIconAlpha($hpic,"shell32.dll", 12,128,128) GUICtrlSetState(-1, $GUI_DISABLE) ;~ GUICtrlSetState(-1,$GUI_ONTOP) ;If you uncomment this..the picture is on top...but the transparency is gone :( GUISetState() While 1 $Msg = GUIGetMsg() If $Msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func _SetIconAlpha($hWnd, $sIcon, $iIndex, $iWidth, $iHeight) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) If $hWnd = 0 Then Return SetError(1, 0, 0) EndIf EndIf If $iIndex <> 0 Then $iIndex = $iIndex - 1 Local $hIcon = _WinAPI_ShellExtractIcon($sIcon, $iIndex, $iWidth, $iHeight) If $hIcon = 0 Then Return SetError(1, 0, 0) EndIf Local $hBitmap, $hObj, $hDC, $hMem, $hSv $hDC = _WinAPI_GetDC($hWnd) $hMem = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight) $hSv = _WinAPI_SelectObject($hMem, $hBitmap) _WinAPI_DrawIconEx($hMem, 0, 0, $hIcon, $iWidth, $iHeight, 0, 0, 2) _WinAPI_ReleaseDC($hWnd, $hDC) _WinAPI_SelectObject($hMem, $hSv) _WinAPI_DeleteDC($hMem) _WinAPI_DestroyIcon($hIcon) _WinAPI_DeleteObject(_SendMessage($hWnd, 0x0172, 0, 0)) _SendMessage($hWnd, 0x0172, 0, $hBitmap) $hObj = _SendMessage($hWnd, 0x0173) If $hObj <> $hBitmap Then _WinAPI_DeleteObject($hBitmap) EndIf Return 1 EndFunc ;==>_SetIconAlpha  
    • XinYoung
      By XinYoung
      For fun, I'm building an app that opens a webpage and refreshes it every 30 seconds.
      But once the script performs _IEAction($oIE, "refresh"), the GUI closes.
      Any help is appreciated.
       

      #include <ButtonConstants.au3>
      #include <EditConstants.au3>
      #include <GUIConstantsEx.au3>
      #include <StaticConstants.au3>
      #include <WindowsConstants.au3>
      #include <WinAPIFiles.au3>
      #include <Array.au3>
      #include <File.au3>
      #include <Excel.au3>
      #include <DateTimeConstants.au3>
      #include <MsgBoxConstants.au3>
      #include <WinAPIShellEx.au3>
      #include <MsgBoxConstants.au3>
      #include <Date.au3>
      #include <ComboConstants.au3>
      #include <guimenu.au3>
      #include <IE.au3>
      HotKeySet("{F4}", "_Exit")
      ;Open the file(s) in the selected folder
      $extension = ".txt"
      $app2openWith = @SystemDir & "\notepad.exe"
      Func Begin()
          Global $loopTrick = 0
          #Region ### START Koda GUI section ### Form=c:\users\mchu\downloads\autoit\my code\form1.kxf
          Global $UI = GUICreate("Hit Em Up!", 256, 113, -1, -1)
          GUISetBkColor(0x000000)
          $menu = _GUICtrlMenu_GetSystemMenu($UI)
          _GUICtrlMenu_EnableMenuItem($menu, $SC_CLOSE, 1, False)
          Global $url = GUICtrlCreateInput("https://www.youtube.com/watch?v=dQw4w9WgXcQ", 81, 8, 160, 21)
          $Label1 = GUICtrlCreateLabel("Target:", 16, 8, 55, 17)
          GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
          GUICtrlSetColor(-1, 0x00FF00)
          Global $StartBut = GUICtrlCreateButton("Start", 16, 40, 67, 25)
          GUICtrlSetFont(-1, 13, 800, 0, "MS Sans Serif")
          GUICtrlSetBkColor(-1, 0x008000)
          $Label2 = GUICtrlCreateLabel("(Press F4 to Exit)", 96, 40, 8000, 17)
          GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
          GUICtrlSetColor(-1, 0x00FF00)
          GUISetState(@SW_SHOW)
          #EndRegion ### END Koda GUI section ###
          While 1
              $UIfunc = GUIGetMsg()
              Select
                  Case $UIfunc = $GUI_EVENT_CLOSE
                      _Exit()
                  Case $UIfunc = $StartBut
                      If GUICtrlRead($url) = "" Then
                          MsgBox(48, "Um...", "Give me a target you idiot.")
                      Else
                          GUICtrlSetState($url, $GUI_DISABLE)
                          GUICtrlSetState($StartBut, $GUI_DISABLE)
                          Start()
                      EndIf
              EndSelect
          WEnd
      EndFunc   ;==>Begin
      Func Start()
          If $loopTrick = 0 Then
              Global $oIE = _IECreate(GUICtrlRead($url))
              _IELoadWait($oIE)
              Again()
          ElseIf $loopTrick = 1 Then
              Sleep(3000)
              _IEAction($oIE, "refresh")
              Sleep(3000)
              Start()
          EndIf
      EndFunc   ;==>Start
      Func Again()
          $loopTrick = 1
          Start()
      EndFunc   ;==>Again
      Func _Exit()
          Exit
      EndFunc   ;==>_Exit
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.