[Solved] ListBox transparent

Get help with using AutoHotkey and its commands and hotkeys
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

[Solved] ListBox transparent

14 Jan 2015, 03:39

Well, I need to have a background image.
Then, I'm going to add a listbox on to the background image; I want a transparent listbox.

How can i do it?

Thanks in advance.
Last edited by empardopo on 15 Jan 2015, 08:57, edited 2 times in total.
Everything is possible!
MJs
Posts: 454
Joined: 23 Sep 2014, 03:29

Re: ListBox transparent

14 Jan 2015, 08:42

may be a listview would do better as I'm not sure about an easy way to get transparency of a child window
there is something about using picture with listview see ListView Remarks in the help file
and if it must be a listbox, use ListView as normal and set the view to List instead of Report
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: ListBox transparent

14 Jan 2015, 09:51

Ufff! I'll take a look. At this moment, I'm lost. :-)
Thanks.
Everything is possible!
just me
Posts: 6426
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: ListBox transparent

15 Jan 2015, 02:56

A forum search for listbox transparent or transparent listbox might be helpful.
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: ListBox transparent

15 Jan 2015, 03:58

just me wrote:A forum search for listbox transparent or transparent listbox might be helpful.
Now, I'm not sure if I made the search here or google! Thanks very much.

I want make you two questions about your class:
1.- Is it possible to hide the vertical scroll bar?
2.- Is it possible to hide the listbox's border?

Thanks very much for your help and your class!
Attachments
transparentListbox.png
Everything is possible!
just me
Posts: 6426
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: ListBox transparent

15 Jan 2015, 04:23

You might specify the -VScroll (scroll bar) and/or -E0x200 (border) options for the ListBox, but the mouse wheel will be the only option for scrolling, then.
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: ListBox transparent

15 Jan 2015, 05:43

-E0x200 works perfect for me.
-VScroll has a function of hide and disable. It's a shame! I need able to scrolling by pressing keys.

Thanks very much.

And last question (by the moment :-), the transparency of the listbox is not full! Is It possible to get a full transparency?

Thanks in advance.
Everything is possible!
just me
Posts: 6426
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: ListBox transparent

15 Jan 2015, 06:29

I just noticed some other glitches with the class. I'll post an update as soon as I'm ready with it. It might support scrolling by key, if I get it to work properly.

In the meantime, would you please post the code you're using?
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: ListBox transparent

15 Jan 2015, 06:37

At this moment, I'm using the source code of the example with a tiny modification

Code: Select all

#NoEnv
PicFile := A_WinDir . "\Web\Wallpaper\Blaues Fenster.jpg"    ; German Win XP
PicFile := A_WinDir . "\Web\Wallpaper\Landscapes\img7.jpg"   ; HP Win 7
Content := "One|Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten|Eleven|Twelve|Thirteen|Fourteen|Fifteen|Sixteen"
; ----------------------------------------------------------------------------------------------------------------------
Global hMain
Gui, New, hwndhMain -Caption
Gui, Font, s15 bold, Tahoma
Gui, Add, Picture, x0 y0 w600 h400 hwndhPic, %PicFile%
;Gui, Add, ListBox, x50 y50 w200 r8 vLB1 gSel1 Choose1, %Content%
;Gui, Add, ListBox, x+100 yp wp hp hwndhLB vLB Choose1 gSelection, %Content%
Gui, Add, ListBox, -VScroll -E0x200 x100 y100 h225 hwndhLB vLB Choose1 gSelection, %Content%
TLB := New TransparentListBox(hLB, hPic, 0x000000, 0x0000FF, 0xFFFFFF, 128)
Gui, Show, w600 h400, Transparent ListBox
Return
; ----------------------------------------------------------------------------------------------------------------------
Esc::
GuiClose:
ExitApp
; ----------------------------------------------------------------------------------------------------------------------
#If WinActive("ahk_id " . hMain)
!x::
   Random, R, 0, % TLB.ItemCount 
   GuiControl, %hMain%:Choose, LB, %R%
Return
Up::
   ;MsgBox % TLB.Items[]
   MsgBox % TLB.CurSel
return
Down::
a::
   temp := TLB.Cursel + 1
   GuiControl, %hMain%:Choose, LB, %temp%
return
#If
; ----------------------------------------------------------------------------------------------------------------------; ----------------------------------------------------------------------------------------------------------------------
k::
Selection:
   GuiControlGet, LB
   ToolTip, Selected: %LB%`nA_GuiEvent: %A_GuiEvent%`nA_EventInfo: %A_EventInfo%
   SetTimer, KillTT, -750
Return

Sel1:
   GuiControlGet, LB1
   ToolTip, Selected: %LB1%`nA_GuiEvent: %A_GuiEvent%`nA_EventInfo: %A_EventInfo%
   SetTimer, KillTT, -750
Return
KillTT:
   ToolTip
Return
; ----------------------------------------------------------------------------------------------------------------------
#Include Class_TransparentListBox.ahk
Why when I press the down key or the a key I don't get scroll down?

Thanks in advance.
Everything is possible!
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: ListBox transparent

15 Jan 2015, 07:35

I don't understand why

Code: Select all

#If WinActive("ahk_id " . hMain)
!x::
   Random, R, 0, % TLB.ItemCount 
   GuiControl, %hMain%:Choose, LB, %R%
Return
#If


works fine and this

Code: Select all

#If WinActive("ahk_id " . hMain)
Down::
a::   
   R := TLB.Cursel + 1
   if R < 15
      GuiControl, %hMain%:Choose, LB, %R%
   MsgBox % TLB.Cursel R
return
#If
not!

Any idea?
Everything is possible!
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: ListBox transparent

15 Jan 2015, 07:58

I think now It's work fine!!!!!!

The final source code

Code: Select all

#NoEnv
PicFile := A_WinDir . "\Web\Wallpaper\Blaues Fenster.jpg"    ; German Win XP
PicFile := A_WinDir . "\Web\Wallpaper\Landscapes\img7.jpg"   ; HP Win 7
Content := "One|Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten|Eleven|Twelve|Thirteen|Fourteen|Fifteen|Sixteen"
; ----------------------------------------------------------------------------------------------------------------------
Global hMain
Gui, New, hwndhMain -Caption
Gui, Font, s15 bold, Tahoma
Gui, Add, Picture, x0 y0 w600 h400 hwndhPic, %PicFile%
;Gui, Add, ListBox, x50 y50 w200 r8 vLB1 gSel1 Choose1, %Content%
;Gui, Add, ListBox, x+100 yp wp hp hwndhLB vLB Choose1 gSelection, %Content%
Gui, Add, ListBox, -VScroll -E0x200 x100 y100 h225 hwndhLB vLB Choose1 gSelection, %Content%
TLB := New TransparentListBox(hLB, hPic, 0x000000, 0x0000FF, 0xFFFFFF, 128)
Gui, Show, w600 h400, Transparent ListBox
Return
; ----------------------------------------------------------------------------------------------------------------------
Esc::
GuiClose:
ExitApp
; ----------------------------------------------------------------------------------------------------------------------
#If WinActive("ahk_id " . hMain)
!x::
   Random, R, 0, % TLB.ItemCount 
   GuiControl, %hMain%:Choose, LB, %R%
Return
#If
#If WinActive("ahk_id " . hMain)
Up::
   ;MsgBox % TLB.Items[]
   ;MsgBox % TLB.CurSel
   R := TLB.Cursel - 0
   if R > 0
      GuiControl, %hMain%:Choose, LB, %R%
return
#If

#If WinActive("ahk_id " . hMain)
Down::
a::   
   R := TLB.Cursel + 2
   if R < TLB.ItemCount
      GuiControl, %hMain%:Choose, LB, %R%
   ;MsgBox % TLB.Cursel R
return
#If


; ----------------------------------------------------------------------------------------------------------------------; ----------------------------------------------------------------------------------------------------------------------
k::
Selection:
   GuiControlGet, LB
   ToolTip, Selected: %LB%`nA_GuiEvent: %A_GuiEvent%`nA_EventInfo: %A_EventInfo%
   SetTimer, KillTT, -750
Return

Sel1:
   GuiControlGet, LB1
   ToolTip, Selected: %LB1%`nA_GuiEvent: %A_GuiEvent%`nA_EventInfo: %A_EventInfo%
   SetTimer, KillTT, -750
Return
KillTT:
   ToolTip
Return
; ----------------------------------------------------------------------------------------------------------------------
#Include Class_TransparentListBox.ahk
The modified part

Code: Select all

#If WinActive("ahk_id " . hMain)
Up::
   R := TLB.Cursel - 0
   if R > 0
      GuiControl, %hMain%:Choose, LB, %R%
return
#If

#If WinActive("ahk_id " . hMain)
Down::
a::   
   R := TLB.Cursel + 2
   if R < TLB.ItemCount
      GuiControl, %hMain%:Choose, LB, %R%
return
#If
Attachments
2015-01-15_13-51-06.gif
Everything is possible!

Return to “Ask For Help”

Who is online

Users browsing this forum: TAC109, teadrinker and 212 guests