Jump to content

Recommended Posts

Posted

First of all I´m german so sorry if I make any mistake.:thumbsup:

I want to make one of my programms, that make settings for designs(.png files) better, so I decidet to include a gui that asks the user what of the options he wants to activate. To try it out without the rest of the programm I wrote it in a new file. When it was finished I tried it out and after fixing some litle mistakes it worked as I imagined bevore. After that I included it with ctrl+c ctrl+v into my programm but it doesen´t work like expected. The gui apears with normal but I can´t click OK now. I don´t know if there is something about it that deactivates it or if I made an other mistake.:mad2:

 

This is the gui only:     (I know the checkboxes are not filled yet)

#include <GUIConstantsEx.au3>
 #include <MsgBoxConstants.au3>
 #include <ButtonConstants.au3>
 #include <WindowsConstants.au3>
 
 $checkboxfenster=GUICreate("AutoUpload", 200, 200)
 Opt("GUIOnEventMode", 1)
 GUICtrlCreateLabel("Wähle aus, auf welchen Platformen du hochladen willlst", 10, 5, 180, 30)

;checkboxen erstellen(in eng: create checkboxes)
$checkbox1=GUICtrlCreateCheckbox("", 10, 50, 180, 15)
GUICtrlSetState(-1, $GUI_CHECKED)
$checkbox2=GUICtrlCreateCheckbox("", 10, 70, 180, 15)
GUICtrlSetState(-1, $GUI_CHECKED)
$checkbox3=GUICtrlCreateCheckbox("", 10, 90, 180, 15)
GUICtrlSetState(-1, $GUI_CHECKED)
$checkbox4=GUICtrlCreateCheckbox("", 10, 110, 180, 15)
GUICtrlSetState(-1, $GUI_CHECKED)
$checkbox5=GUICtrlCreateCheckbox("", 10, 130, 180, 15)
GUICtrlSetState(-1, $GUI_CHECKED)
$checkbox6=GUICtrlCreateCheckbox("", 10, 150, 180, 15)
GUICtrlSetState(-1, $GUI_CHECKED)
$checkbox7=GUICtrlCreateCheckbox("Readbubble", 10, 170, 70, 15)
GUICtrlSetState(-1, $GUI_CHECKED)

$button010=GUICtrlCreateButton("OK", 125, 175, 50, 20)
GUICtrlSetOnEvent($button010, "Button010")
GUISetState(@SW_SHOW)

;warte-/entlastungsschleife(in eng: something like wait to relieve the pc)
While 1
Sleep(10000)
WEnd


;wenn button gedrückt wird(in eng: if butten is pressed)
Func Button010()
  MsgBox(0, "", "")
  if BitAnd(GUICtrlRead($checkbox1),$GUI_CHECKED)=$GUI_CHECKED Then
    $checkbox1=1
  EndIf
  if BitAnd(GUICtrlRead($checkbox1),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
    $checkbox1=0
  EndIf
  if BitAnd(GUICtrlRead($checkbox2),$GUI_CHECKED)=$GUI_CHECKED Then
    $checkbox2=1
  EndIf
  if BitAnd(GUICtrlRead($checkbox2),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
    $checkbox2=0
  EndIf
  if BitAnd(GUICtrlRead($checkbox3),$GUI_CHECKED)=$GUI_CHECKED Then
    $checkbox3=1
  EndIf
  if BitAnd(GUICtrlRead($checkbox3),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
    $checkbox3=0
  EndIf
  if BitAnd(GUICtrlRead($checkbox4),$GUI_CHECKED)=$GUI_CHECKED Then
    $checkbox4=1
  EndIf
  if BitAnd(GUICtrlRead($checkbox4),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
    $checkbox4=0
  EndIf
  if BitAnd(GUICtrlRead($checkbox5),$GUI_CHECKED)=$GUI_CHECKED Then
    $checkbox5=1
  EndIf
  if BitAnd(GUICtrlRead($checkbox5),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
    $checkbox5=0
  EndIf
  if BitAnd(GUICtrlRead($checkbox6),$GUI_CHECKED)=$GUI_CHECKED Then
    $checkbox6=1
  EndIf
  if BitAnd(GUICtrlRead($checkbox6),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
    $checkbox6=0
  EndIf
  if BitAnd(GUICtrlRead($checkbox7),$GUI_CHECKED)=$GUI_CHECKED Then
    $checkbox7=1
  EndIf
  if BitAnd(GUICtrlRead($checkbox7),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
    $checkbox7=0
  EndIf
  Pruefen()
EndFunc

Func Pruefen()
    If $checkbox1+$checkbox2+$checkbox3+$checkbox4+$checkbox5+$checkbox6+$checkbox7=0 Then
        MsgBox(48, "", "Du musst mindestens eine Platform auswählen")
    Else
        Weiter()
    EndIf
EndFunc

Func Weiter()
    GUIDelete()
EndFunc
;last func isn´t realy useful without the rest

 

 

And this is the code until this gui

#include <GUIConstantsEx.au3>
 #include <MsgBoxConstants.au3>
 #include <ButtonConstants.au3>
 #include <WindowsConstants.au3>
 #include <WinAPIFiles.au3>
 #include <FileConstants.au3>
 #include <File.au3>
 #include <Array.au3>
;-------------------------------------------------------------------------------
;Notabbruch Pause(in eng: emergency stop)
;-------------------------------------------------------------------------------
HotKeySet("!e","_exit")
Func _exit()
   Exit
EndFunc
;-------------------------------------------------------------------------------
;Variablen
;-------------------------------------------------------------------------------
$fenster1=1
;-------------------------------------------------------------------------------
;Startfenster
;-------------------------------------------------------------------------------
Local $array1=_FileListToArray("Designs\nicht hochgeladen\Designs weiß")
If @error Then
   $wert1=0
Else
   $wert1=$array1[0]
   $nummer=$wert1
   While $nummer>0
   $name=StringTrimRight($array[$nummer], 4)
   _FileCreate("Designnamen\weiß\"&$name)
   $nummer=$nummer-1
   WEnd
EndIf
Local $array2=_FileListToArray("Designs\nicht hochgeladen\Designs schwarz")
If @error Then
   $wert2=0
Else
   $wert2=$array2[0]
   $nummer=$wert2
   While $nummer>0
   $name=StringTrimRight($array[$nummer], 4)
   _FileCreate("Designnamen\schwarz\"&$name)
   $nummer=$nummer-1
   WEnd
EndIf

;nachfragen, wenn keine designs vorhanden
If $wert1+$wert2<1 Then
   If MsgBox($MB_TOPMOST+4+32, "AutoUpload", "Es befinden sich keine noch nicht hochgeladenen Designs auf deinem Computer"&@CRLF&@CRLF&"Willst du nur schon hochgeladene Designs konfigurieren")=7 Then
      Schliessen()
   EndIf
   _FileCreate("$konf.txt")
   While 1
      ;guimode
      Opt("GUIOnEventMode", 1)

      ;variablen
      Local $startfenster=GUICreate("AutoUpload", 300, 200)

      Local $ok=GUICtrlCreateButton("OK", 160, 175, 60, 20)
      Local $cancel=GUICtrlCreateButton("Schließen", 230, 175, 60, 20)

      Local $w1=GUICtrlCreateInput("", 50, 70, 50, 20)
      Local $w2=GUICtrlCreateInput("", 50, 120, 50, 20)

      ;text
      GUICtrlCreateLabel("Gib hier ein, wie viel Designs du für den jeweiligen"&@CRLF&"hintergrund konfigurieren möchtest", 10, 10)
      GUICtrlCreateLabel("Dunkler Hintergrund", 50, 50, 200)
      GUICtrlCreateLabel("Heller Hintergrund", 50, 100, 200)

      ;button aktiviere
      GUICtrlSetOnEvent($ok, "OK")
      GUICtrlSetOnEvent($cancel, "Schliessen")

      ;fenster zeigen
      GUISetState(@SW_SHOW, $startfenster)

      ;entlasstungsschleife
      While 1
         Sleep(500)
      WEnd
   WEnd
Else
   OK()
EndIf

;-------------------------------------------------------------------------------
;Funktionen
;-------------------------------------------------------------------------------
Func Schliessen()
   If MsgBox(48+4, "AutoUpload", "Willst du AutoUpload wirklich schließen, ohne ein Deseign hoch zu laden")=6 Then
      Exit
   EndIf
EndFunc

Func OK()
   $wert1=GUICtrlRead($w1)
   $wert2=GUICtrlRead($w2)
   GUIDelete()
   $wert01=$wert1
   $wert02=$wert2
   If $wert1+$wert2=0 Then
      If MsgBox(48+1, "AutoUpload", "Du musst mindestens ein Design hochladen"&@CRLF&@CRLF&"Wenn du kein Designs hochladen willst, drücke Abbrechen")=2 Then
         Exit
      EndIf
   Else
      $fortschrittfenster=1
   EndIf
;---------------------------------------------------------------------------------------------------------------------------
;here is the gui from above where I con´t click OK
;------------------------------------------------------------------------------------------------------------------------------
   ;Gui und inhalt erstellen(in eng: create gui)
   $checkboxfenster=GUICreate("AutoUpload", 200, 200)
   Opt("GUIOnEventMode", 1)
   GUICtrlCreateLabel("Wähle aus, auf welchen Platformen du hochladen willlst", 10, 5, 180, 30)

   ;checkboxen erstellen(in eng: create checkboxes
   $checkbox1=GUICtrlCreateCheckbox("", 10, 50, 180, 15)
   GUICtrlSetState(-1, $GUI_CHECKED)
   $checkbox2=GUICtrlCreateCheckbox("", 10, 70, 180, 15)
   GUICtrlSetState(-1, $GUI_CHECKED)
   $checkbox3=GUICtrlCreateCheckbox("", 10, 90, 180, 15)
   GUICtrlSetState(-1, $GUI_CHECKED)
   $checkbox4=GUICtrlCreateCheckbox("", 10, 110, 180, 15)
   GUICtrlSetState(-1, $GUI_CHECKED)
   $checkbox5=GUICtrlCreateCheckbox("", 10, 130, 180, 15)
   GUICtrlSetState(-1, $GUI_CHECKED)
   $checkbox6=GUICtrlCreateCheckbox("", 10, 150, 180, 15)
   GUICtrlSetState(-1, $GUI_CHECKED)
   $checkbox7=GUICtrlCreateCheckbox("", 10, 170, 80, 15)
   GUICtrlSetState(-1, $GUI_CHECKED)


   $button010=GUICtrlCreateButton("OK", 125, 175, 50, 20)
   GUICtrlSetOnEvent($button010, "Button010")
   GUISetState(@SW_SHOW)

   ;warte-/entlastungsschleife
   While 1
      Sleep(10000)
   WEnd
EndFunc

   ;wenn button gedrückt wird
   Func Button010()
      MsgBox(0, "", "")
      if BitAnd(GUICtrlRead($checkbox1),$GUI_CHECKED)=$GUI_CHECKED Then
         $checkbox1=1
      EndIf
      if BitAnd(GUICtrlRead($checkbox1),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
         $checkbox1=0
      EndIf
      if BitAnd(GUICtrlRead($checkbox2),$GUI_CHECKED)=$GUI_CHECKED Then
         $checkbox2=1
      EndIf
      if BitAnd(GUICtrlRead($checkbox2),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
         $checkbox2=0
      EndIf
      if BitAnd(GUICtrlRead($checkbox3),$GUI_CHECKED)=$GUI_CHECKED Then
         $checkbox3=1
      EndIf
      if BitAnd(GUICtrlRead($checkbox3),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
         $checkbox3=0
      EndIf
      if BitAnd(GUICtrlRead($checkbox4),$GUI_CHECKED)=$GUI_CHECKED Then
         $checkbox4=1
      EndIf
      if BitAnd(GUICtrlRead($checkbox4),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
         $checkbox4=0
      EndIf
      if BitAnd(GUICtrlRead($checkbox5),$GUI_CHECKED)=$GUI_CHECKED Then
         $checkbox5=1
      EndIf
      if BitAnd(GUICtrlRead($checkbox5),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
         $checkbox5=0
      EndIf
      if BitAnd(GUICtrlRead($checkbox6),$GUI_CHECKED)=$GUI_CHECKED Then
         $checkbox6=1
      EndIf
      if BitAnd(GUICtrlRead($checkbox6),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
         $checkbox6=0
      EndIf
      if BitAnd(GUICtrlRead($checkbox7),$GUI_CHECKED)=$GUI_CHECKED Then
         $checkbox7=1
      EndIf
      if BitAnd(GUICtrlRead($checkbox7),$GUI_UNCHECKED)=$GUI_UNCHECKED Then
         $checkbox7=0
      EndIf
      Pruefen()
   EndFunc

   Func Pruefen()
   If $checkbox1+$checkbox2+$checkbox3+$checkbox4+$checkbox5+$checkbox6+$checkbox7=0 Then
         MsgBox(48, "", "Du musst mindestens eine Platform auswählen")
      Else
         Weiter()
      EndIf
   EndFunc

   Func Weiter()
      GUIDelete()
;Here normaly is the other code but I don´t think it´s part of the problem

Hope you saw the mistake.

If you found it in german we would say "tausend dank". I don´t know how to translate it but an exact translation would be "tousend thanks".

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