Jump to content

Script not working??


Recommended Posts

Hey guys just wondering why me script isnt displaying a picture, everything works its just the picture will not show up. The only way i can get it to work is if i change the highlighted line (<<<<<<<<<<<<<<<<<<<) to this:

 

$hPic_background = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\Examples\GUI\Picture.jpg",0,0,0,0)

 

Does any one know why and how i can fix this?

 

#include <GUIConstantsEx.au3>
Global $hGuiWin = GUICreate ( "Test",458,198)
$button1=GuiCtrlCreateButton("African Cichlids",0,0,114,33)
$button2=GuiCtrlCreateButton("American Cichlids",0,33,114,33)
$button3=GuiCtrlCreateButton("Angel Fishes",0,66,114,33)
$button4=GuiCtrlCreateButton("Catfishes",0,99,114,33)
$button5=GuiCtrlCreateButton("Characins",0,132,114,33)
$button6=GuiCtrlCreateButton("Cyprinids",0,165,114,33)
$button7=GuiCtrlCreateButton("Invertebrates",0,198,114,33)
$button8=GuiCtrlCreateButton("Killifishes",114,0,114,33)
$button9=GuiCtrlCreateButton("Labyrinth",114,33,114,33)
$button10=GuiCtrlCreateButton("Live Bearers",114,66,114,33)
$button11=GuiCtrlCreateButton("Loaches",114,99,114,33)
$button12=GuiCtrlCreateButton("Misc",114,132,114,33)
$button13=GuiCtrlCreateButton("Plecos",114,165,114,33)
$button14=GuiCtrlCreateButton("Rainbowfishes",114,198,114,33)
$hPic_background = GUICtrlCreatePic(@ScriptDir & "...\Images\Picture.jpg",458,198) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetState($hPic_background, $GUI_DISABLE)
GUISetState(@SW_SHOW)
While 1
$msg=GuiGetMsg()
If $msg=-3 Then Exit
If $msg=$button1 Then button1()
If $msg=$button2 Then button2()
If $msg=$button3 Then button3()
If $msg=$button4 Then button4()
If $msg=$button5 Then button5()
If $msg=$button6 Then button6()
If $msg=$button7 Then button7()
If $msg=$button8 Then button8()
If $msg=$button9 Then button9()
If $msg=$button10 Then button10()
If $msg=$button11 Then button11()
If $msg=$button12 Then button12()
If $msg=$button13 Then button13()
If $msg=$button14 Then button14()

Wend




Func button1()
    GuiCreate("African Cichlids")
    GuiSetState()

EndFunc

Func button2()
    GuiCreate("American Cichlids")
    GuiSetState()
EndFunc

Func button3()
GuiCreate("Angel Fishes")
    GuiSetState()
EndFunc

Func button4()
GuiCreate("Catfishes")
    GuiSetState()
EndFunc

Func button5()
GuiCreate("Characins")
    GuiSetState()
EndFunc

Func button6()
GuiCreate("Cyprinids")
    GuiSetState()
EndFunc

Func button7()
GuiCreate("Invertebrates")
    GuiSetState()
EndFunc

Func button8()
GuiCreate("Killifishes")
    GuiSetState()
EndFunc

Func button9()
GuiCreate("Labyrinth")
    GuiSetState()
EndFunc

Func button10()
GuiCreate("Live bearers")
    GuiSetState()
EndFunc

Func button11()
GuiCreate("Loaches")
    GuiSetState()
EndFunc

Func button12()
GuiCreate("Misc")
    GuiSetState()
EndFunc

Func button13()
GuiCreate("Plecos")
    GuiSetState()
EndFunc

Func button14()
GuiCreate("Rainbowfishes")
    GuiSetState()
EndFunc
Do
    $msg = GUIGetMsg()
 Until $msg = $GUI_EVENT_CLOSE
 Exit
Edited by Melba23
Added code tags
Link to comment
Share on other sites

  • Moderators

Phaisius,

When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Phaisius,

When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. ;)

M23

ok sorry i am a noob at this, my bad, thanks for the help

Link to comment
Share on other sites

if the image you want to load is located in a directory named images and this directory is located in the same path of the running script, then just remove the 3 dot from the above line and change it like this:

$hPic_background = GUICtrlCreatePic(@ScriptDir & "\Images\Picture.jpg",458,198) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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