Jump to content

two problems with buttons


7h331337
 Share

Recommended Posts

Your buttons are true bitmap pics... not icon pics

By tricking the script, this works

[font="Verdana"]#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GuiButton.au3>[/font][font="Verdana"]Opt("GUIOnEventMode", 1)
Local $icon[100]
Global $file, $Random, $file2, $x, $y, $ic, $min, $mini
$p = 1
$x = 10
$y = 10
$file = "pic1.jpg"
$file2 = "pic2.jpg"[/font][font="Verdana"]HotKeySet("{f1}", "runit")[/font][font="Verdana"]GUICreate("gamesnet explore", @DesktopWidth, @DesktopHeight, 0, 0, $ws_popup)
GUICtrlCreatePic($file, 0, 0, @DesktopWidth / 5 * 4, @DesktopHeight)
GUICtrlSetState( -1, $GUI_DISABLE)
GUICtrlCreatePic($file2, @DesktopWidth / 5 * 4, 0, @DesktopWidth / 5, @DesktopHeight)
GUICtrlSetState( -1, $GUI_DISABLE)[/font][font="Verdana"]$lable1 = GUICtrlCreateLabel(@HOUR & ":" & @MIN, @DesktopWidth / 5 * 4 + 10, 10, 200, 70)
If @DesktopWidth > 700 And @DesktopWidth < 900 Then
 $width = 35
Else
 $width = 50[/font][font="Verdana"]EndIf[/font][font="Verdana"]GUICtrlSetBkColor($lable1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($lable1, $width, $width)
GUICtrlSetColor($lable1, 0xffffff)
counticon()
GUISetState()[/font][font="Verdana"]While 1
 
 
 If @MIN > $mini Then
  GUICtrlSetData($lable1, @HOUR & ":" & @MIN)
 EndIf
 Sleep(100)
 $mimi = $min
 $min = @MIN[/font][font="Verdana"]WEnd[/font][font="Verdana"]Func runit()
 $input = InputBox("run", "run")
 Run($input)
EndFunc   ;==>runit
Func counticon()[/font][font="Verdana"] $ini = IniRead(@ScriptDir & "\icon.ini", "icons", "number", 1)
 For $i = 1 To $ini Step 1
  
  $icon[$i] = GUICtrlCreateButton("red", $y, $x, 32, 32, $BS_BITMAP)
  GUICtrlSetImage(-1, @ScriptDir & "\icon" & $i & ".ico")
  ;msgbox(0,"",$icon[$i])
  ;_GUICtrlButton_SetImage($icon[$i], @ScriptDir & "\icon"& $i & ".ico" )[/font][font="Verdana"]  
  $x = $x + 44
  If $x = @DesktopHeight / 4 * 3 Then
   $x = 10
   $y = $y + 10
  EndIf
 Next[/font][font="Verdana"]EndFunc   ;==>counticon[/font]

THE CORRECT WAY IS TO SAVE THE PICS AS TRUE .ICO FILES

... then use your script

8)

EDIT: fixed disable pics

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

is still cant get the msgbox to apper wen i click the buttonscan any one tell me y this is thanks

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GuiButton.au3>


Local $icon[100]
Global $file, $Random, $file2, $x, $y, $ic, $min, $mini
$p = 1
$x = 10
$y = 10
$file = "pic1.jpg"
$file2 = "pic2.jpg"
$logo = "logo.jpg"
HotKeySet("{f1}", "runit")
Opt("GUIOnEventMode", 1)
GUICreate("gamesnet explore", @DesktopWidth, @DesktopHeight, 0, 0, $ws_popup)
GUICtrlCreatePic($file, 0, 0, @DesktopWidth / 5 * 4, @DesktopHeight)
GUICtrlCreatePic($file2, @DesktopWidth / 5 * 4, 0, @DesktopWidth / 5, @DesktopHeight)

$lable1 = GUICtrlCreateLabel(@HOUR & ":" & @MIN, @DesktopWidth / 5 * 4 + 10, 10, 200, 70)
If @DesktopWidth > 700 And @DesktopWidth < 900 Then
    $width = 35
Else
    $width = 50

EndIf

GUICtrlSetBkColor($lable1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($lable1, $width, $width)
GUICtrlSetColor($lable1, 0xffffff)
counticon()
GUISetState()
While 1

    Sleep(500)
    GUICtrlSetOnEvent($icon[1], "msg")
    

    

    If @MIN > $mini Then
        GUICtrlSetData($lable1, @HOUR & ":" & @MIN)
    EndIf
    
    $mimi = $min
    $min = @MIN

WEnd

Func runit()
    $input = InputBox("run", "run")
    Run($input)
EndFunc  ;==>runit
Func counticon()

    $ini = IniRead(@ScriptDir & "\icon.ini", "icons", "number", 1)
    For $i = 1 To $ini Step 1

        $icon[$i] = GUICtrlCreateButton("", $y, $x, 32, 32, $BS_BITMAP)
        GUICtrlSetImage($icon[$i], @ScriptDir & "\icon" & $i & ".ico")
        GUICtrlSetOnEvent($icon[$i],"iconconfig")
        msgbox(0,"",$icon[$i])
        $x = $x + 44
        If $x = @DesktopHeight / 4 * 3 Then
            $x = 10
            $y = $y + 10
        EndIf
    Next

EndFunc  ;==>counticon
Func msg()
    MsgBox(0, "", "")
;### Tidy Error -> "endif" is closing previous "func"
EndFunc
func iconconfig()
msgbox(0,"",@GUI_CtrlHandle)    
EndFunc
Link to comment
Share on other sites

Valuater showed you but you haven't done it

GUICtrlCreatePic($file, 0, 0, @DesktopWidth / 5 * 4, @DesktopHeight)
GUICtrlSetState( -1, $GUI_DISABLE);<------------------------------------------------add this line like Valuater's script.
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

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