Jump to content

Recommended Posts

Posted

Hi all,

When I run this it will show the button 'sometimes' on the first execution. But running the script again from the editor it will not show the button until you click on the image.

Any ideas?

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Local $sURL = "https://home.comcast.net/~mnjjames/new.jpg"
Local $sFilePath = @ScriptDir & "\test.jpg"
InetGet($sURL, $sFilePath)

$GUI = GuiCreate("Button v1.0", 175, 75)
GUICtrlSetColor(-1,0xFB1409)

$hListView = _GUICtrlListView_Create ($GUI, "", 2, 2, 596, 500, -1, -1, True)
_GUICtrlListView_SetBkImage ($hListView, $sFilePath)

$contextMenu = GuiCtrlCreateContextMenu()
GuiCtrlCreateMenuItem("Context Menu", $contextMenu)
GuiCtrlCreateMenuItem("", $contextMenu);separator
GuiCtrlCreateMenuItem("&Properties", $contextMenu)

$Button1r1 = GUICtrlCreateButton("Button", 66, 25, 40, 20)

GUISetState(@SW_SHOW)
                        
While 1
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button1r1
            Run("notepad.exe")

Case $GUI_EVENT_CLOSE
            _Exit()
EndSwitch
Wend

Func _Exit()
    Exit
EndFunc

GUIDelete()
Posted

If you want the image to just be a background then use something like this:

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
Local $sURL = "https://home.comcast.net/~mnjjames/new.jpg"
Local $sFilePath = @ScriptDir & "\test.jpg"
InetGet($sURL, $sFilePath)

$GUI = GuiCreate("Button v1.0", 175, 75)
GUICtrlSetColor(-1,0xFB1409)

GUICtrlCreatePic($sFilePath, 0, 0, 100, 67, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)

$contextMenu = GuiCtrlCreateContextMenu()
GuiCtrlCreateMenuItem("Context Menu", $contextMenu)
GuiCtrlCreateMenuItem("", $contextMenu);separator
GuiCtrlCreateMenuItem("&Properties", $contextMenu)

$Button1r1 = GUICtrlCreateButton("Button", 66, 25, 40, 20)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button1r1
            Run("notepad.exe")
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
Wend
Posted

If you want the image to just be a background then use something like this:

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
Local $sURL = "https://home.comcast.net/~mnjjames/new.jpg"
Local $sFilePath = @ScriptDir & "\test.jpg"
InetGet($sURL, $sFilePath)

$GUI = GuiCreate("Button v1.0", 175, 75)
GUICtrlSetColor(-1,0xFB1409)

GUICtrlCreatePic($sFilePath, 0, 0, 100, 67, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)

$contextMenu = GuiCtrlCreateContextMenu()
GuiCtrlCreateMenuItem("Context Menu", $contextMenu)
GuiCtrlCreateMenuItem("", $contextMenu);separator
GuiCtrlCreateMenuItem("&Properties", $contextMenu)

$Button1r1 = GUICtrlCreateButton("Button", 66, 25, 40, 20)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button1r1
            Run("notepad.exe")
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
Wend
Thank you sir. As to why, the other code being in there, I'd adapted it out of the helpfile. Make perfect sense now. Thank you very much.
Posted

Slight wrinkle.

Is there a way to make it to where the image doesn't make the tabs virtually invisible?

Posted

Come on now. Read the documentation!

Remarks

...

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). This is not enough for Tab or Listview control which behave differently. In this case you need to create the picture with the $WS_CLIPSIBLINGS style, GuiCtrlSetState(-1,$GUI_ONTOP) is necessary for the Tab or Listview control.

Posted

Come on now. Read the documentation!

That is in there,

Does it have to be setup under the tab?

#include <GuiConstantsEx.au3>

#include <GuiListView.au3>

#include <WindowsConstants.au3>

Local $sURL = "https://home.comcast.net/~mnjjames/new.jpg"

Local $sFilePath = @ScriptDir & "\test.jpg"

InetGet($sURL, $sFilePath)

; GUI

$GUI = GuiCreate(" Helpabel v2.0", 370, 150)

GuiSetIcon("C:\WINDOWS\system32\shell32.dll", 45)

GUICtrlCreatePic($sFilePath, 0, 0, 370, 125, $WS_CLIPSIBLINGS)

GuiCtrlSetState(-1,$GUI_ONTOP)

;v2.0 - 3/28/08

GuiCtrlCreateLabel("v2.0", 336, 129, 136, 20)

GUICtrlSetColor(-1,0x867C92)

; CONTEXT MENU

$contextMenu = GuiCtrlCreateContextMenu()

GuiCtrlCreateMenuItem("Context Menu", $contextMenu)

GuiCtrlCreateMenuItem("", $contextMenu)

GuiCtrlCreateMenuItem("&Properties", $contextMenu)

Posted

No no no. You use GuiCtrlSetState(-1, $GUI_ONTOP) on the tab control (which i don't even see in your code). You are talking about tab controls are you not?

Posted

No no no. You use GuiCtrlSetState(-1, $GUI_ONTOP) on the tab control (which i don't even see in your code). You are talking about tab controls are you not?

That worked. I thank you heartily. I just want to say I'm trying here. I'm learning more daily, but I'm not an old hack at this yet.

It didn't occur to me that I should work in layers on this. It make better sense now. Again, thank you.

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
×
×
  • Create New...