Jump to content

Parent GUI w/ backgroundimage and transparent child GUI ontop?


zvvyt
 Share

Recommended Posts

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,

Link to comment
Share on other sites

  • Moderators

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. :)

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

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

Link to comment
Share on other sites

  • Moderators

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

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

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,

Link to comment
Share on other sites

  • Moderators

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

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 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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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)
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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

  • Moderators

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

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

  • Moderators

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

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

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

×
×
  • Create New...