Sign in to follow this  
Followers 0
PhoenixXL

Autoit Gui buttons not able to click

5 posts in this topic

In this Gui im not able to click the buttons however the alt+(the shortcut key works),i uploaded only two pics for reference of what is being done.

thanks in advance for any help

#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <mouseonevent.au3>
#NoTrayIcon
Opt("GUIOnEventMode",1)
Opt("TrayIconDebug", 1)
Opt("MustDeclareVars",1)
Global $hBmp_Logo,$aCinfo,$hImage_Logo,$hPic,$hGUI
$hGUI = GUICreate("Test", 500, 430,0,0,BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS),$WS_EX_TOOLWINDOW)
GUISetOnEvent($GUI_EVENT_CLOSE,"_exit")
GUICtrlCreatePic("C:\Users\abhishek\Desktop\Swirly_Blue_Abstract.jpg",0,0,500,430)
Global $hButton[8],$hButton1
$hButton[1] = GUICtrlCreateButton("&Odin", 10, 10, 80, 30,$BS_CENTER)
$hButton[2] = GUICtrlCreateButton("&Chrome", 10, 50, 80, 30,$BS_CENTER)
$hButton[3] = GUICtrlCreateButton("&Games", 10, 90, 80, 30,$BS_CENTER)
$hButton[4] = GUICtrlCreateButton("&Applications", 10, 130, 80, 30,$BS_CENTER)
$hButton[5] = GUICtrlCreateButton("&Videos", 10, 170, 80, 30,$BS_CENTER)
$hButton[6] = GUICtrlCreateButton("&Images", 10, 210, 80, 30,$BS_CENTER)
$hButton[0] = GUICtrlCreateButton("&Scripts", 10, 250, 80, 30,$BS_CENTER)
$hButton[7] = GUICtrlCreateButton("&My Computer", 10, 340, 480, 70,BitOR($BS_CENTER,$BS_DEFPUSHBUTTON))
For $o=0 To 6 Step 1
GUICtrlSetOnEvent($hButton[$o],"_redirect")
GUICtrlSetCursor($hButton[$o],0)
Next
Global $path[8]
$path[1]="C:\Odin\Diet\DietOdin.exe"
$path[2]="C:\Users\abhishek\AppData\Local\Google\Chrome\Application\chrome.exe"
$path[3]="D:\,\Games"
$path[4]="D:\,\Apps"
$path[5]="C:\Users\abhishek\Desktop\Presentation\Video"
$path[6]="C:\Users\abhishek\Desktop\Presentation\Images"
$path[7]="EXPLORER.EXE /e,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
$path[0]="C:\Users\abhishek\Desktop\Presentation\A"
Global $hPic[8]
$hPic[7]=_LoadTransparentGif("C:\Users\abhishek\Desktop\Computer.gif")
$hPic[3]=_LoadTransparentGif("C:\Users\abhishek\Desktop\Games.gif")
GUICtrlSetState(-1, $GUI_HIDE)
$hPic[5]= _LoadTransparentGif("C:\Users\abhishek\Desktop\Videos.gif")
GUICtrlSetState(-1, $GUI_HIDE)
$hPic[0] = GUICtrlCreatePic("C:\Users\abhishek\Desktop\Scripts.JPG", 100, 10,390,280)
GUICtrlSetState(-1, $GUI_HIDE)
$hPic[2] = GUICtrlCreatePic("C:\Users\abhishek\Desktop\Chrome.jpg", 100, 10,390,280)
GUICtrlSetState(-1, $GUI_HIDE)
$hPic[4] = GUICtrlCreatePic("C:\Users\abhishek\Desktop\Apps.JPG", 100, 10,390,280)
GUICtrlSetState(-1, $GUI_HIDE)
$hPic[6] = GUICtrlCreatePic("C:\Users\abhishek\Desktop\images (7).JPG", 100, 10,390,280)
GUICtrlSetState(-1, $GUI_HIDE)
$hPic[1] = GUICtrlCreatePic("C:\Users\abhishek\Desktop\Odin.gif", 100, 10,390,280)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState()
While 1
; Check what is under the cursor
    $aCInfo = GUIGetCursorInfo($hGUI)
     ; If it is the button
For $I=0 To 6
     If $aCinfo[4] = $hButton[$I] Then
         ; Check if picture is hidden
         If BitAND(GUICtrlGetState($hPic[$I]),$GUI_HIDE) Then
             ; if so then show it
             GUICtrlSetState($hPic[$I],$GUI_SHOW)
    GUICtrlSetState($hPic[7], $GUI_HIDE)
         EndIf
     ; If it is not the button
  Else
         ; Check if picture is showing
          If BitAND(GUICtrlGetState($hPic[$I]),$GUI_SHOW) Then
             ; If so then hide it
             GUICtrlSetState($hPic[$I], $GUI_HIDE)
    GUICtrlSetState($hPic[7], $GUI_SHOW)
         EndIf
     EndIf
Next
WEnd
Func _redirect()
For $o=0 To 7 Step 1
  Switch @GUI_CtrlId
   Case $hButton[$o]
    If $o=7 Then Run($path[$o])
    If $o<>7 Then ShellExecute($path[$o])
  EndSwitch
Next
EndFunc

Func _exit()
Exit
EndFunc
Func _LoadTransparentGif($pwm)
_GDIPlus_Startup()
    Local Const $STM_SETIMAGE = 0x0172
Local $variable
    $hImage_Logo = _GDIPlus_ImageLoadFromFile($pwm)
    $hBmp_Logo = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage_Logo)
    $variable = GUICtrlCreatePic("",170, 50,250,205)
    _WinAPI_DeleteObject(GUICtrlSendMsg($variable, $STM_SETIMAGE, 0, $hBmp_Logo))
    _WinAPI_DeleteObject($hBmp_Logo)
    _GDIPlus_ImageDispose($hImage_Logo)
    _GDIPlus_Shutdown()
Return $variable
EndFunc   ;==>_GUICreateBanner


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



I can click the buttons with the primary mouse button. And if I change "For $o=0 To 6 Step 1" to "For $o=0 To 7 Step 1" (you don't need "Step 1") I can also click the My Computer button, and it opens Explorer.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

yes i got the point ,the pic I set as background was making all the problems.since i didnt uploaded the pic LarsJ was able to click and got it working.just not getting why the buttons are not working when the background loads.In place of "Swirly_Blue_Abstract.jpg" please put any other pic and test if it is working

GUICtrlCreatePic("C:UsersabhishekDesktopSwirly_Blue_Abstract.jpg",0,0,500,430)

Thanks In Advance For Any Help

Edited by abhishek660

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

abhishek660,

just not getting why the buttons are not working when the background loads

If I had £1 for each time I had answered this question I would be considerably richer. ;)

From the Help file for GUICtrlCreatePic:

"If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control [...]: GuiCtrlSetState(-1,$GUI_DISABLE)"

Do that and your controls will work. :)

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

Thanks very much for the help Melba23 I got it working


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

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