Seite 3 von 7

Re: Ein Infofenster anzeigen

Verfasst: 21.06.2013 23:02
von derschutzhund
Ok, dass ist kein Problem dann poste ich mal die ganzen Dateien die vom VisualGeneratDeluxe erzeugt werden:

Main:

Code: Alles auswählen

;-TOP

;- Visual Generate Main Program for Purebasic

; ***************************************************************************************
;
; Comment       : 
; Author        : 
; Second Author : 
; File          : 
; Version       : 
; Create        : 
; Update        : 
; 
; Compilermode  : 
;
; ***************************************************************************************

;- Global Variable
Global ExitApplication = 0

; ***************************************************************************************

;- Include CommonFile
IncludeFile "CommonFile.pb"

;- Include UserFiles
;IncludeFile "???.pb"

;- Include EventFiles
IncludeFile "EventMenu.pb"
IncludeFile "EventGadget.pb"
IncludeFile "EventWindow.pb"
IncludeFile "EventMain.pb"

; ***************************************************************************************

;- Main Program
Procedure Main()

  Open_Window_0()
  
  If WindowID(#Window_0)
    
    Repeat
    
      Select WaitWindowEvent()
      
        Case #PB_Event_Menu
          MyEventMenu(EventMenu())
        Case #PB_Event_Gadget
          MyEventGadget(EventGadget(), EventType())
        Case #PB_Event_SizeWindow
          MyEventSize(EventWindow())
        Case #PB_Event_CloseWindow
          MyEventExit(EventWindow())
        Case #PB_Event_Repaint
          ;
        Case #PB_Event_MoveWindow
          ;
        Case #PB_Event_ActivateWindow
          ;
        Case #PB_Event_SysTray
          ;
      EndSelect
      
    Until ExitApplication = 1
    
  EndIf

EndProcedure:Main()

End

; ***************************************************************************************
commonfile.pb

Code: Alles auswählen

; Visual Generate Commonfile (Do Not Edit - Allways Overwrite)

; ***************************************************************************************

;- Window Constants
;
Enumeration
  #Window_0
EndEnumeration

;- Menubar Constants
;
Enumeration
EndEnumeration

;- MenuItem Constants
;
Enumeration
EndEnumeration

;- Gadget Constants
;
Enumeration
  #Window_0_Text_0
  #Window_0_button_Info
  #Window_0_Checkbox_0_perseinstell
  #Window_0_Checkbox_numlock
  #Window_0_Frame3D_3
  #Window_0_Option_kein_netz
  #Window_0_Option_LAN
  #Window_0_Option_WLAN_wpa
  #Window_0_Option_WLAN_wpa2
  #Window_0_String_passwort
  #Window_0_String_routername
  #Window_0_Checkbox_firewall
  #Window_0_Checkbox_cpufrequ
  #Window_0_Checkbox_drucker
  #Window_0_Checkbox_videoeinst
  #Window_0_Checkbox_xserver
  #Window_0_Button_save_konfig
  #Window_0_Button_save_startoption
  #Window_0_Button_fertig
  #Window_0_Editor_1
  #Window_0_Container_0
EndEnumeration

;- StatusBar Constants
;
Enumeration
EndEnumeration

;- ToolBar Constants
;
Enumeration
EndEnumeration

;- Image Constants
;
Enumeration
EndEnumeration


Enumeration #PB_Compiler_EnumerationValue
  #Font_0
  #Font_1
  #Font_2
  #Font_3
EndEnumeration

LoadFont(#Font_0,"Sans", 24, #PB_Font_Bold | #PB_Font_Italic)
LoadFont(#Font_1,"Sans", 24)
LoadFont(#Font_2,"Sans", 13)
LoadFont(#Font_3,"Sans", 14)


; ***************************************************************************************

;- Image Plugin

;- Load Images


; ***************************************************************************************

; Form Designer for Purebasic - 5.11

; ***************************************************************************************

Procedure Open_Window_0()
  OpenWindow(#Window_0, #PB_Ignore, #PB_Ignore, 530, 530, "ConfigMaster 1.0", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  TextGadget(#Window_0_Text_0, 20, 10, 380, 40, "ConfigMaster", #PB_Text_Center)
  SetGadgetColor(#Window_0_Text_0, #PB_Gadget_FrontColor,RGB(0,5,255))
  SetGadgetColor(#Window_0_Text_0, #PB_Gadget_BackColor,RGB(255,243,0))
  SetGadgetFont(#Window_0_Text_0, FontID(#Font_0))
  ButtonGadget(#Window_0_button_Info, 410, 10, 100, 40, "INFO")
  GadgetToolTip(#Window_0_button_Info, "Das ist eine mehrzeilige Info")
  SetGadgetFont(#Window_0_button_Info, FontID(#Font_1))
  CheckBoxGadget(#Window_0_Checkbox_0_perseinstell, 46, 60, 424, 25, "Dialog fuer persoenliche Einstellungen anzeigen")
  SetGadgetFont(#Window_0_Checkbox_0_perseinstell, FontID(#Font_2))
  CheckBoxGadget(#Window_0_Checkbox_numlock, 46, 90, 424, 25, "Numlock einschalten")
  SetGadgetFont(#Window_0_Checkbox_numlock, FontID(#Font_2))
  Frame3DGadget(#Window_0_Frame3D_3, 26, 130, 484, 200, "Netzwerkeinstellung")
  SetGadgetFont(#Window_0_Frame3D_3, FontID(#Font_3))
  OptionGadget(#Window_0_Option_kein_netz, 51, 160, 419, 25, "Kein Netzwerk fuer Internet vorhanden")
  SetGadgetFont(#Window_0_Option_kein_netz, FontID(#Font_2))
  OptionGadget(#Window_0_Option_LAN, 51, 190, 439, 25, "Netzwerk ueber Kabel automatisch aufbauen")
  SetGadgetFont(#Window_0_Option_LAN, FontID(#Font_2))
  OptionGadget(#Window_0_Option_WLAN_wpa, 51, 230, 449, 25, "WLAN-Verbindung mit WPA-Verschluesselung aufbauen")
  SetGadgetFont(#Window_0_Option_WLAN_wpa, FontID(#Font_2))
  OptionGadget(#Window_0_Option_WLAN_wpa2, 51, 260, 449, 25, "WLAN-Verbindung mit WPA2-Verschluesselung aufbauen")
  SetGadgetFont(#Window_0_Option_WLAN_wpa2, FontID(#Font_2))
  StringGadget(#Window_0_String_passwort, 350, 290, 126, 25, "Passwort")
  SetGadgetFont(#Window_0_String_passwort, FontID(#Font_3))
  StringGadget(#Window_0_String_routername, 80, 290, 120, 25, "Routername")
  SetGadgetFont(#Window_0_String_routername, FontID(#Font_3))
  CheckBoxGadget(#Window_0_Checkbox_firewall, 40, 340, 250, 20, "Firewall aktivieren")
  SetGadgetFont(#Window_0_Checkbox_firewall, FontID(#Font_2))
  CheckBoxGadget(#Window_0_Checkbox_cpufrequ, 40, 370, 330, 20, "CPU-Frequenzskalierung aktivieren")
  SetGadgetFont(#Window_0_Checkbox_cpufrequ, FontID(#Font_2))
  CheckBoxGadget(#Window_0_Checkbox_drucker, 40, 400, 330, 20, "Druckereinstellungen aktivieren")
  SetGadgetFont(#Window_0_Checkbox_drucker, FontID(#Font_2))
  CheckBoxGadget(#Window_0_Checkbox_videoeinst, 40, 430, 370, 20, "Eigene Videoeinstellungen aktivieren")
  SetGadgetFont(#Window_0_Checkbox_videoeinst, FontID(#Font_2))
  CheckBoxGadget(#Window_0_Checkbox_xserver, 40, 460, 270, 20, "X-Server neu starten")
  SetGadgetFont(#Window_0_Checkbox_xserver, FontID(#Font_2))
  ButtonGadget(#Window_0_Button_save_konfig, 20, 490, 180, 30, "Konfiguration sichern")
  SetGadgetFont(#Window_0_Button_save_konfig, FontID(#Font_2))
  ButtonGadget(#Window_0_Button_save_startoption, 210, 491, 190, 29, "Startoptionen sichern")
  SetGadgetFont(#Window_0_Button_save_startoption, FontID(#Font_2))
  ButtonGadget(#Window_0_Button_fertig, 410, 490, 100, 30, "Fertig")
  SetGadgetFont(#Window_0_Button_fertig, FontID(#Font_2))
  EditorGadget(#Window_0_Editor_1, 50, 126, 440, 254, #PB_Editor_ReadOnly)
  HideGadget(#Window_0_Editor_1, 1)
  SetGadgetColor(#Window_0_Editor_1, #PB_Gadget_FrontColor,RGB(252,255,0))
  SetGadgetColor(#Window_0_Editor_1, #PB_Gadget_BackColor,RGB(4,0,255))
  SetGadgetFont(#Window_0_Editor_1, FontID(#Font_3))
  AddGadgetItem(#Window_0_Editor_1, -1, "hallo jetzt geht es", 0, 1)
  AddGadgetItem(#Window_0_Editor_1, -1, "Information zur zweiten Zeile", 0, 2)
  AddGadgetItem(#Window_0_Editor_1, -1, "nr3", 0, 3)
  ContainerGadget(#Window_0_Container_0, 240, 101, 250, 249, #PB_Container_Raised)
  HideGadget(#Window_0_Container_0, 1)
  SetGadgetColor(#Window_0_Container_0, #PB_Gadget_BackColor,RGB(255,255,0))
  CloseGadgetList()
EndProcedure

; ***************************************************************************************

Eventmenu.pb

Code: Alles auswählen

;-TOP

; Visual Generate Event Menu

; ***************************************************************************************

eventgadget.pb

Code: Alles auswählen

;-TOP

; Visual Generate Event Gadget

; ***************************************************************************************

Procedure EventGadget_Window_0_button_Info(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
        HideGadget(#Window_0_Container_0,0)

        
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Checkbox_0_perseinstell(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Checkbox_numlock(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Option_kein_netz(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Option_LAN(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Option_WLAN_wpa(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Option_WLAN_wpa2(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_String_passwort(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_String_routername(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Checkbox_firewall(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Checkbox_cpufrequ(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Checkbox_drucker(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Checkbox_videoeinst(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Checkbox_xserver(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Button_save_konfig(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Button_save_startoption(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
         Debug GetGadgetState(#Window_0_Editor_1)
 
  EndSelect
  
EndProcedure

; ***************************************************************************************

Procedure EventGadget_Window_0_Button_fertig(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
   End
  EndSelect
  
EndProcedure

; ***************************************************************************************


Procedure EventGadget_Window_0_Editor_1(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      Debug "info"

  EndSelect
  
EndProcedure

; ***************************************************************************************




Procedure EventGadget_Window_0_Container_0(EventType)
  
  Select EventType
    Case #PB_EventType_LeftClick
      
  EndSelect
  
EndProcedure

; ***************************************************************************************

eventwindow.pb

Code: Alles auswählen

;-TOP

; Visual Generate Event Window

; ***************************************************************************************

Procedure EventSize_Window_0()
  
EndProcedure

; ***************************************************************************************

Procedure EventExit_Window_0()
  ExitApplication = 1
EndProcedure

; ***************************************************************************************

eventmain.pb

Code: Alles auswählen

;-TOP

; Visual Generate EventMain (Do Not Edit - Allways Overwrite)

; *********************************************************************************************************

; Init Event Pointer

Prototype MyProtoInvoke()
Prototype MyProtoInvoke1(EventType)

Structure udtCallEvent
  Invoke.MyProtoInvoke[0]
EndStructure

Structure udtCallEvent1
  Invoke.MyProtoInvoke1[0]
EndStructure

Global *CallEventMenu.udtCallEvent    = ?CallEventMenu
Global *CallEventGadget.udtCallEvent1 = ?CallEventGadget
Global *CallEventSize.udtCallEvent    = ?CallEventSize
Global *CallEventExit.udtCallEvent    = ?CallEventExit

#CallEventMenuCount   = 0
#CallEventGadgetCount = 21
#CallEventWindowCount = 1

; *********************************************************************************************************

Procedure MyEventMenu(MenuID)
  If MenuID >= 0 And MenuID < #CallEventMenuCount
    *CallEventMenu\Invoke[MenuID]()
  EndIf
EndProcedure

; *********************************************************************************************************

Procedure MyEventGadget(GadgetID, EventType)
  If GadgetID >= 0 And GadgetID < #CallEventGadgetCount
    *CallEventGadget\Invoke[GadgetID](EventType)
  EndIf
EndProcedure

; *********************************************************************************************************

Procedure MyEventSize(WindowID)
  If WindowID >= 0 And WindowID < #CallEventWindowCount
    *CallEventSize\Invoke[WindowID]()
  EndIf
EndProcedure

; *********************************************************************************************************

Procedure MyEventExit(WindowID)
  If WindowID >= 0 And WindowID < #CallEventWindowCount
    *CallEventExit\Invoke[WindowID]()
  EndIf
EndProcedure

; *********************************************************************************************************

Procedure MyEventDispatch(EventType)
  
EndProcedure

; *********************************************************************************************************

DataSection
  CallEventMenu:
  CallEventGadget:
    Data.i @MyEventDispatch()
    Data.i @EventGadget_Window_0_button_Info()
    Data.i @EventGadget_Window_0_Checkbox_0_perseinstell()
    Data.i @EventGadget_Window_0_Checkbox_numlock()
    Data.i @MyEventDispatch()
    Data.i @EventGadget_Window_0_Option_kein_netz()
    Data.i @EventGadget_Window_0_Option_LAN()
    Data.i @EventGadget_Window_0_Option_WLAN_wpa()
    Data.i @EventGadget_Window_0_Option_WLAN_wpa2()
    Data.i @EventGadget_Window_0_String_passwort()
    Data.i @EventGadget_Window_0_String_routername()
    Data.i @EventGadget_Window_0_Checkbox_firewall()
    Data.i @EventGadget_Window_0_Checkbox_cpufrequ()
    Data.i @EventGadget_Window_0_Checkbox_drucker()
    Data.i @EventGadget_Window_0_Checkbox_videoeinst()
    Data.i @EventGadget_Window_0_Checkbox_xserver()
    Data.i @EventGadget_Window_0_Button_save_konfig()
    Data.i @EventGadget_Window_0_Button_save_startoption()
    Data.i @EventGadget_Window_0_Button_fertig()
    Data.i @EventGadget_Window_0_Editor_1()
    Data.i @EventGadget_Window_0_Container_0()
  CallEventSize:
    Data.i @EventSize_Window_0()
  CallEventExit:
    Data.i @EventExit_Window_0()
EndDataSection

; *********************************************************************************************************
Das sollte jetzt alles gewesen sein...

Re: Ein Infofenster anzeigen

Verfasst: 21.06.2013 23:06
von Kiffi
ich sehe da nur einen Container.

Damit das ganze klappt, muss Du Deine anderen Gadgets ebenfalls in einen Container verfrachten.

Und dann blendest Du entweder den einen oder den anderen ein.

Grüße ... Kiffi

Re: Ein Infofenster anzeigen

Verfasst: 21.06.2013 23:09
von ts-soft
Schön übersichtlich dieses Generierte Zeuchs :bounce:
In Procedure Open_Window_0() kann ich nur einen einzigen Container sehen, der auch keinerlei
Gadgets enhält. Also meine Lösung haste jedenfalls nicht umgesetzt.
Aber wenn Deine mausgeschubste Form jetzt geht ist ja alles schön.

Gruß
Thomas

Re: Ein Infofenster anzeigen

Verfasst: 21.06.2013 23:47
von derschutzhund
In Procedure Open_Window_0() kann ich nur einen einzigen Container sehen, der auch keinerlei
Gadgets enhält.
Ich dachte halt es wäre logisch und ausreichend wenn das letzte Element das erzeugt wird, bleibend .. na ja, is ja auch egal!

Re: Ein Infofenster anzeigen

Verfasst: 22.06.2013 00:07
von ts-soft
Hier mal das Prinzip als Code:

Code: Alles auswählen

EnableExplicit

OpenWindow(0, #PB_Ignore, #PB_Ignore, 640, 480, "")

ContainerGadget(0, 10, 10, WindowWidth(0) - 20, WindowHeight(0) - 120, #PB_Container_Double)
  EditorGadget(1, 10, 10, GadgetWidth(0) - 20, GadgetHeight(0) - 20)
  SetGadgetText(1, "Container 0")
CloseGadgetList()
ContainerGadget(2, 10, 10, WindowWidth(0) - 20, WindowHeight(0) - 120, #PB_Container_Double)
  EditorGadget(3, 10, 10, GadgetWidth(2) - 20, GadgetHeight(2) - 20)
  SetGadgetText(3, "Container 2")
CloseGadgetList()

OptionGadget(4, 20, 400, 100, 25, "Container 0")
OptionGadget(5, 200, 400, 100, 25, "Container 2")
HideGadget(2, #True)
SetGadgetState(4, #True)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 4
          HideGadget(0, #False)
          HideGadget(2, #True)
        Case 5
          HideGadget(0, #True)
          HideGadget(2, #False)
      EndSelect
  EndSelect
ForEver
Es wird immer nur zwischen den Containern geswitcht und dadurch der gesamte Inhalt aus oder angeschaltet.
Bei dem Beispiel sind nur jeweils ein edit, aber für mehr bin ich jetzt zu faul.

Re: Ein Infofenster anzeigen

Verfasst: 22.06.2013 00:28
von derschutzhund
@ts-soft
der Ansatz mit den Containern funktioniert jetzt so!
Ich könnte dann in dem "Infocontainer" einen "Close-Button" einbauen mit dem der Infocontainer wieder gelöscht und der normale Containerinhalt wieder angezeigt wird.
Ist zwar etwas umständlich aber zur Not geht es!

Eine Frage noch:

Code: Alles auswählen

OptionGadget(4, 20, 400, 100, 25, "Container 0")
OptionGadget(5, 200, 400, 100, 25, "Container 2")
Was machen diese beiden Zeilen?

Ich schalte die beiden Container mit diesen Zeilen um:
HideGadget(#Window_0_Container_1,1)
HideGadget(#Window_0_Container_0,0)

Re: Ein Infofenster anzeigen

Verfasst: 22.06.2013 00:52
von Kiffi
derschutzhund hat geschrieben:Was machen diese beiden Zeilen?
Bild

Re: Ein Infofenster anzeigen

Verfasst: 24.06.2013 12:51
von mk-soft
Procedure EventGadget_Window_0_Button_fertig(EventType)

Select EventType
Case #PB_EventType_LeftClick
End
EndSelect

EndProcedure
Da gehört wohl eher ein "ExitApplication = 1" rein

Re: Ein Infofenster anzeigen

Verfasst: 25.06.2013 12:21
von dysti
Hallo @derschutzhund, du benutzt wohl eine alte PB-Version.
Mit dem neuen Form-Designer hättest du fast den gleichen Code generiert wie TS-Soft.

Schaust du hier: http://www.youtube.com/watch?v=d3v6pZa9WCM

Re: Ein Infofenster anzeigen

Verfasst: 25.06.2013 12:26
von ts-soft
dysti hat geschrieben:Mit dem neuen Form-Designer hättest du fast den gleichen Code generiert wie TS-Soft.
der aber nicht generiert wurde! :mrgreen: