Jump to content

help with icons!


liquid
 Share

Recommended Posts

You could create a button and use a picture on it instead of text.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

You could create a button and use a picture on it instead of text.

<{POST_SNAPBACK}>

ok i will try that! so the icon thing isnt a good idea? and how do i insert a picture inside the button? Edited by liquid
Link to comment
Share on other sites

ok i will try that! so the icon thing isnt a good idea?

<{POST_SNAPBACK}>

It may be a good enough idea but I do not know how to do it


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Hi,

I've made an example program to help you on your way.

Look in the help file how to change things to your wishes.

Have fun with it.

Dick

EDIT: change the names of the icon and bmp file to someting on your pc. Else you get blank buttons.

#include <GUIConstants.au3>

$GuiMain = GUICreate("Button Test", 200, 100)

$btnIcon = GUICtrlCreateButton("", 10, 25, 50, 50, $BS_ICON)
GUICtrlSetImage($btnIcon, "FileType2.ico")

$btnBmp = GUICtrlCreateButton("", 75, 25, 50, 50, $BS_ICON)
GUICtrlSetImage($btnBmp, "Newtion.bmp")

$btnPict = GUICtrlCreatePic("Newtion.bmp", 140, 25, 50, 50)

GUISetState(@SW_SHOW)


While(1)
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE 
            Exit
        Case $Msg = $btnIcon
            MsgBox(0, "Button", "Icon Clicked")
        Case $Msg = $btnBmp
            MsgBox(0, "Button", "Picture Buttonclicked")
        Case $Msg = $btnPict
            MsgBox(0, "Picture", "Picture Clicked")
    EndSelect
WEnd

Exit
Edited by Dickb
Link to comment
Share on other sites

Hi,

I've made an example program to help you on your way.

Look in the help file how to change things to your wishes.

Have fun with it.

Dick

EDIT: change the names of the icon and bmp file to someting on your pc. Else you get blank buttons.

#include <GUIConstants.au3>

$GuiMain = GUICreate("Button Test", 200, 100)

$btnIcon = GUICtrlCreateButton("", 10, 25, 50, 50, $BS_ICON)
GUICtrlSetImage($btnIcon, "FileType2.ico")

$btnBmp = GUICtrlCreateButton("", 75, 25, 50, 50, $BS_ICON)
GUICtrlSetImage($btnBmp, "Newtion.bmp")

$btnPict = GUICtrlCreatePic("Newtion.bmp", 140, 25, 50, 50)

GUISetState(@SW_SHOW)
While(1)
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE 
            Exit
        Case $Msg = $btnIcon
            MsgBox(0, "Button", "Icon Clicked")
        Case $Msg = $btnBmp
            MsgBox(0, "Button", "Picture Buttonclicked")
        Case $Msg = $btnPict
            MsgBox(0, "Picture", "Picture Clicked")
    EndSelect
WEnd

Exit

<{POST_SNAPBACK}>

thank u verru much, but now i wonder how to bind the button to a file like an .exe

i hope im not to :whistle: now

Link to comment
Share on other sites

thank u verru much, but now i wonder how to bind the button to a file like an .exe

i hope im not to :whistle: now

<{POST_SNAPBACK}>

I made a litte change to the example.

Now every button will start notepad. Is this what you want?

Replace notepad with the program name you want to start.

#include <GUIConstants.au3>

$GuiMain = GUICreate("Button Test", 200, 100)

$btnIcon = GUICtrlCreateButton("", 10, 25, 50, 50, $BS_ICON)
GUICtrlSetImage($btnIcon, "FileType2.ico")

$btnBmp = GUICtrlCreateButton("", 75, 25, 50, 50, $BS_ICON)
GUICtrlSetImage($btnBmp, "Newtion.bmp")

$btnPict = GUICtrlCreatePic("Newtion.bmp", 140, 25, 50, 50)

GUISetState(@SW_SHOW)

While(1)
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $btnIcon
            Run("Notepad.exe")
        Case $Msg = $btnBmp
            Run("Notepad.exe")
        Case $Msg = $btnPict
            Run("Notepad.exe")
    EndSelect
WEnd

Exit
Link to comment
Share on other sites

I made a litte change to the example.

Now every button will start notepad. Is this what you want?

Replace notepad with the program name you want to start.

#include <GUIConstants.au3>

$GuiMain = GUICreate("Button Test", 200, 100)

$btnIcon = GUICtrlCreateButton("", 10, 25, 50, 50, $BS_ICON)
GUICtrlSetImage($btnIcon, "FileType2.ico")

$btnBmp = GUICtrlCreateButton("", 75, 25, 50, 50, $BS_ICON)
GUICtrlSetImage($btnBmp, "Newtion.bmp")

$btnPict = GUICtrlCreatePic("Newtion.bmp", 140, 25, 50, 50)

GUISetState(@SW_SHOW)

While(1)
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $btnIcon
            Run("Notepad.exe")
        Case $Msg = $btnBmp
            Run("Notepad.exe")
        Case $Msg = $btnPict
            Run("Notepad.exe")
    EndSelect
WEnd

Exit

<{POST_SNAPBACK}>

thats exactly what i want! thank you :whistle: but ure script is wierd, when i start it 101 notepads show up Edited by liquid
Link to comment
Share on other sites

thats exactly what i want! thank you :whistle: but ure script is wierd, when i start it 101 notepads show up

<{POST_SNAPBACK}>

I have tested it (copied and pasted). Only one notepad is starting.

Tested with Autoit 3.1.1 and beta 3.1.1.70. Both versions are working.

Check your code (or better, start with a copy and paste)

Are you sure the "$Msg = GUIGetMsg()" is inside the While loop?

Link to comment
Share on other sites

I have tested it (copied and pasted).  Only one notepad is starting.

Tested with Autoit 3.1.1 and beta 3.1.1.70. Both versions are working.

Check your code (or better, start with a copy and paste)

Are you sure the "$Msg = GUIGetMsg()" is inside the While loop?

<{POST_SNAPBACK}>

I copied and pasted it and I get loads and loads of notepad. I closed it before it reached 101.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

I'm sorry, but that is a mistery to me. Works fine on my computer.

<{POST_SNAPBACK}>

ok this is what i want: when i click my little firefox icon firefox.exe will start, here's my script so far

; ----------------------------------------------------------------------------

;

; AutoIt Version: 3.1.0

; Author: LiquiD

;

; Script Function:

; My own program launcher!.

;

; ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GuiConstants.au3>

SplashImageOn("APL", "add_your_image" ,

300 , 200)

Sleep(3000)

SplashOff()

; GUI

GuiCreate("APL 0.1", 200, 600)

;the icons!

GUICtrlCreateButton ("firefox", 10,20,40,40, $BS_icon)

GUICtrlSetImage (-1, "C:\Program\Mozilla Firefox\firefox.exe",2)

;ist always open now, untill it closes..duh!!

GUISetState ()

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

now what do i need to do to make this happen?

Link to comment
Share on other sites

I've changed part of your code. My filefox is in the "Program Files" directory.

This should help you on your way.

;the icons!
$btnFireFox = GUICtrlCreateButton("firefox", 10, 20, 40, 40, $BS_icon)
GUICtrlSetImage(-1, "C:\Program Files\Mozilla Firefox\firefox.exe", 2)

;ist always open now, untill it closes..duh!!
GUISetState()
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $btnFireFox Then Run("C:\Program Files\Mozilla Firefox\firefox.exe")
WEnd
Link to comment
Share on other sites

I've changed part of your code. My filefox is in the "Program Files" directory.

This should help you on your way.

;the icons!
$btnFireFox = GUICtrlCreateButton("firefox", 10, 20, 40, 40, $BS_icon)
GUICtrlSetImage(-1, "C:\Program Files\Mozilla Firefox\firefox.exe", 2)

;ist always open now, untill it closes..duh!!
GUISetState()
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $btnFireFox Then Run("C:\Program Files\Mozilla Firefox\firefox.exe")
WEnd

<{POST_SNAPBACK}>

worked like a charm, now im starting to get the hang of things. Thanks Dickb :whistle:
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...