Jump to content

Opacity slider


 Share

Recommended Posts

Ok so I gave my GUI a slider bar and my first problem I ran into was that my GUI is a black window but I see the slider shows up as an ugly white box in the GUI, I tried changing the color but it didn't seem to do anything, my next problem was how I can read the slider value and make that the opacity, I mean if know how I would do it I just can't seem to figure out the actual wording for it. If someone can help me with these two problems I would appreciate it. This is the only user friendly idea that came to mind for opacity but maybe someone else likes a different way to do this they could share with me on changing opacity. Thanks!

I assumed this would be a pretty common question but I couldn't find anything, not even with google.

Edited by kjpolker
Link to comment
Share on other sites

Yeah so its not a white square, can I not make the slider white with the background of the slider black?

And when I added this line

WinSetTrans("[CLASS:Autoit v3 GUI]", "", GUICtrlRead($Slider1))

It didn't change the transperancy of the window, is there a command to set the value of the slider? as of now I am just using the actual slider variable that made the GUI

$slider1 = GUICtrlCreateSlider(250, 5, 100, 20)
Edited by kjpolker
Link to comment
Share on other sites

guictrlread ()

winsettrans ()

edit : AH!! brett beat me to it

Edited by CodyBarrett
Link to comment
Share on other sites

I still need help lol, how do I determine the value of the slider?

in the help file under GUICtrlSetData() it just says "For slider: value" and I don't know what that means,

GUICtrlSetData($slider1, 'value')

That wont work.

And how do I make the slider a little more bolder and clearer ad make the background of the slider the color of my GUI window and not white?

Edited by kjpolker
Link to comment
Share on other sites

guictrlsetlimit?

Link to comment
Share on other sites

should... as long as the return value < 256.... like from 0 - 255 transparency

Link to comment
Share on other sites

while 1;YOUR MAIN WHILE LOOP
winsettrans ('[active]','',Guictrlread ($Slider))
sleep (100)
wend

Link to comment
Share on other sites

Here is an example :) (Compatible with Beta and Stable)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <SliderConstants.au3>
#include<Misc.au3>

#region - GUI Create
$hGUI = GUICreate('test')
GUISetBkColor(0)
GUICtrlSetDefBkColor(0)
Global $iSlider = GUICtrlCreateSlider(10, 10, 300, 30)
GUICtrlSetBkColor(-1,0)
GUICtrlSetLimit(-1, 255, 1)
GUICtrlSetData(-1, 255)
GUISetState()
#endregion

Global $giOldTRans
If _VersionCompare(@AutoItVersion, '3.3.1.0') > 0 Then
    Execute('AdlibRegister("_UpdatePos", 100)')
Else
    Execute('AdlibEnable("_UpdatePos", 100)')
EndIf

#region - GUI SelectLoop
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $iSlider
            WinSetTrans($hGUI, "", GUICtrlRead($iSlider))
    EndSelect
WEnd
#endregion

Func _UpdatePos()
    Local $trans = GUICtrlRead($iSlider)
    If $giOldTRans = $trans Then Return
    WinSetTrans($hGUI, "", $trans)
    $giOldTRans = $trans
EndFunc

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...