Jump to content

Insert picture/pictures using the button


Recommended Posts

#Include <GUIConstants.au3>
#include <ColorConstants.au3>
#include <MsgBoxConstants.au3>
#include <GDIPlus.au3>

Opt("GUIOnEventMode", 1)

_gui_settings()
Func _gui_settings()
    $Settings = GUICreate("Settings", 615, 438, 192, 124)
    $mFRET = GUICtrlCreateMenu("&FRET")
    $mEndpoint_FRET = GUICtrlCreateMenuItem("&Endpoint", $mFRET)
    Local Static $FRET_Static = GUICtrlSetOnEvent(-1, "_tab_FRET")
    $Button_Cancel = GUICtrlCreateButton("Cancel", 450, 370, 70, 20)
    GUICtrlSetOnEvent(-1, "_ende")
    $Button_OK = GUICtrlCreateButton("OK", 530, 370, 70, 20)
    GUICtrlSetOnEvent(-1, "_ende")
    GUISetOnEvent($GUI_EVENT_CLOSE, "_ende")
    GUISetState(@SW_SHOW)
    While 1
    Sleep(10)
    WEnd
    GUISetState(@SW_HIDE)
EndFunc

Func _ende()
    Exit
EndFunc

_tab_FRET()
Func _tab_FRET()
    Local Static $idTab = GUICtrlCreateTab(0, 10, 620, 355)
        Local Static $ReadArea = GUICtrlCreateTabItem("Read Area")
            $Checkbox_allWells = GUICtrlCreateCheckbox("Select All", 545, 45, 97, 17)
                GUICtrlSetOnEvent(-1,"_Bereich_alle")
            $Pic_Wellplate = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplatepic.jpg", 70, 60, 467, 300)
            $Button_1 = GUICtrlCreateButton ("1", 125, 45, 40, 20)
                GUICtrlSetOnEvent(-1,"_Bereich_1")
            $Button_2 = GUICtrlCreateButton ("2", 175, 45, 40, 20)
                GUICtrlSetOnEvent (-1,"_Bereich_2")
            $Button_3 = GUICtrlCreateButton ("3", 225, 45, 40, 20)
                GUICtrlSetOnEvent(-1,"_Bereich_3")
            $Button_4 = GUICtrlCreateButton ("4", 275, 45, 40, 20)
            $Button_5 = GUICtrlCreateButton ("5", 325, 45, 40, 20)
            $Button_6 = GUICtrlCreateButton ("6", 375, 45, 40, 20)
            $Button_7 = GUICtrlCreateButton ("7", 425, 45, 40, 20)
            $Button_8 = GUICtrlCreateButton ("8", 475, 45, 40, 20)
        Local Static $MoreSettings = GUICtrlCreateTabItem("More Settings")
        Local Static $mEnd = GUICtrlCreateTabItem("")
        GUISetState(@SW_SHOW)
EndFunc

Func _Bereich_alle() ; No Pics shown
    $Checkbox_allWells = GUICtrlCreateCheckbox("Select All", 545, 45, 97, 17)
    GUICtrlSetState(-1,$GUI_HIDE)
    If $Checkbox_allWells And BitAND(GUICtrlRead($Checkbox_allWells), $GUI_CHECKED) = $GUI_CHECKED Then
        $Pic_Spalte1 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplate_Spalte.jpg", 120, 98, 49, 253)
        GUICtrlSetState(-1,$GUI_SHOW)
        Local $Pic_Spalte2 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplate_Spalte.jpg", 170, 98, 49, 253)
        GUICtrlSetState(-1,$GUI_SHOW)
        Local $Pic_Spalte3 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplate_Spalte.jpg", 220, 98, 49, 253)
        GUICtrlSetState(-1,$GUI_SHOW)
        Local $Pic_Spalte4 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplate_Spalte.jpg", 270, 98, 49, 253)
        GUICtrlSetState(-1,$GUI_SHOW)
        Local $Pic_Spalte5 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplate_Spalte.jpg", 320, 98, 49, 253)
        GUICtrlSetState(-1,$GUI_SHOW)
        Local $Pic_Spalte6 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplate_Spalte.jpg", 370, 98, 49, 253)
        GUICtrlSetState(-1,$GUI_SHOW)
        Local $Pic_Spalte7 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplate_Spalte.jpg", 420, 98, 49, 253)
        GUICtrlSetState(-1,$GUI_SHOW)
        Local $Pic_Spalte8 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplate_Spalte.jpg", 470, 98, 49, 253)
        GUICtrlSetState(-1,$GUI_SHOW)
    EndIf
EndFunc

Func _Bereich_1()
    $Button_1 = GUICtrlCreateButton ("1", 125, 45, 40, 20)
    GUICtrlSetState(-1, $GUI_HIDE)
    If $Button_1 And BitAND(GUICtrlRead($Button_1), $GUI_CHECKED) = $GUI_CHECKED Then
        Local $Pic_Spalte1 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplate_Spalte.jpg", 120, 98, 49, 253)
        GUICtrlSetState($Pic_Spalte1,$GUI_ENABLE)
    EndIf
EndFunc
Func _Bereich_2()
    $Button_2 = GUICtrlCreateButton ("2", 175, 45, 40, 20)
    GUICtrlSetState(-1, $GUI_HIDE)
    If $Button_2 And BitAND(GUICtrlRead($Button_2), $GUI_CHECKED) = $GUI_CHECKED Then
        Local $Pic_Spalte2 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplate_Spalte.jpg", 170, 98, 49, 253)
        GUICtrlSetState($Pic_Spalte2,$GUI_ENABLE)
    EndIf
EndFunc
Func _Bereich_3()
    $Button_3 = GUICtrlCreateButton ("3", 225, 45, 40, 20)
    GUICtrlSetState(-1, $GUI_HIDE)
    If $Button_3 And BitAND(GUICtrlRead($Button_3), $GUI_CHECKED) = $GUI_CHECKED Then
        Local $Pic_Spalte3 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplate_Spalte.jpg", 220, 98, 49, 253)
        GUICtrlSetState($Pic_Spalte3,$GUI_ENABLE)
    EndIf
EndFunc

Hello it`s me again 🙃

Since hours I try to solve the problem without success... I need your help.

Why is it not possible to insert the picture of the "Bereich_alle" and "_Bereich_2" function and why do the pictures ( $Pic_Spalte1) also appear on the "More Settings" tab?

Link to post
Share on other sites

Concept of your script is so bad that it makes no sense to me, what exactly you want to do ...

Sorry, I think you should learn more AutoIt's basics from helpfile instead of such poor "scripting" which is more trying ...

 

You badly recreate the same controls without removing previous, you use Local variables for controls instead of Global (accesible from other functions), ...

and this is absolute nonsense:

 If $Button_1 And BitAND(GUICtrlRead($Button_1), $GUI_CHECKED) = $GUI_CHECKED Then
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...