In_Go hat geschrieben:Der Visual Designer erzeugt einige Fehlermeldungen
- Bei Ballontip() sollte der 1. Parameter eine WindowID(#Win) sein!
- Bei Createmenu() ist im 2. Parameter die WindowID() falsch.
There is indeed a Visual Designer released with PB4 Beta that generates PB4 compatible code.
Balloontip procedure is correct, as the parameter WindowID is not the WindowID() function, but the Windows handle of the Gadget.
Code: Alles auswählen
Procedure BalloonTip(WindowID, Gadget, Text$ , Title$, Icon)
ToolTip=CreateWindowEx_(0,"ToolTips_Class32","",#WS_POPUP | #TTS_NOPREFIX | #TTS_BALLOON,0,0,0,0,WindowID,0,GetModuleHandle_(0),0)
..............
BalloonTip(GadgetID(#Button_0), #Button_0, Language$(5), Language$(6), #TOOLTIP_NO_ICON)
There was a bug in generated menu code and statusbar code.
Here is a new version that fixes the bugs in the generated code.
http://users.pandora.be/berikco/downloa ... v4code.zip
The generated code works fine now in PB4
Code: Alles auswählen
; PureBasic Visual Designer v3.93 build 1482 (PB4Code)
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- MenuBar Constants
;
Enumeration
#MenuBar_0
EndEnumeration
Enumeration
#MENU_1
#MENU_2
EndEnumeration
;- Gadget Constants
;
Enumeration
#Button_0
#Button_1
EndEnumeration
;- StatusBar Constants
;
Enumeration
#StatusBar_0
EndEnumeration
Global Dim Language$(7)
Procedure BalloonTip(WindowID, Gadget, Text$ , Title$, Icon)
ToolTip=CreateWindowEx_(0,"ToolTips_Class32","",#WS_POPUP | #TTS_NOPREFIX | #TTS_BALLOON,0,0,0,0,WindowID,0,GetModuleHandle_(0),0)
SendMessage_(ToolTip,#TTM_SETTIPTEXTCOLOR,GetSysColor_(#COLOR_INFOTEXT),0)
SendMessage_(ToolTip,#TTM_SETTIPBKCOLOR,GetSysColor_(#COLOR_INFOBK),0)
SendMessage_(ToolTip,#TTM_SETMAXTIPWIDTH,0,180)
Balloon.TOOLINFO\cbSize=SizeOf(TOOLINFO)
Balloon\uFlags=#TTF_IDISHWND | #TTF_SUBCLASS
Balloon\hWnd=GadgetID(Gadget)
Balloon\uId=GadgetID(Gadget)
Balloon\lpszText=@Text$
SendMessage_(ToolTip, #TTM_ADDTOOL, 0, Balloon)
If Title$ > ""
SendMessage_(ToolTip, #TTM_SETTITLE, Icon, @Title$)
EndIf
EndProcedure
Procedure Open_Window_0()
If OpenWindow(#Window_0, 226, 7, 600, 300, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "New window ( 0 )")
If CreateMenu(#MenuBar_0, WindowID(#Window_0))
MenuTitle(Language$(0))
MenuItem(#MENU_1, Language$(1))
MenuItem(#MENU_2, Language$(2))
EndIf
If CreateStatusBar(#StatusBar_0, WindowID(#Window_0))
AddStatusBarField(100)
StatusBarText(#StatusBar_0, 0, Language$(3))
EndIf
If CreateGadgetList(WindowID(#Window_0))
ButtonGadget(#Button_0, 60, 90, 90, 30, Language$(4))
BalloonTip(GadgetID(#Button_0), #Button_0, Language$(5), Language$(6), #TOOLTIP_NO_ICON)
ButtonGadget(#Button_1, 60, 150, 90, 30, Language$(7))
EndIf
EndIf
EndProcedure
Procedure ReadCatalog(Filename$)
If ReadFile(0, Filename$)
If ReadString(0) = "Catalog"
For k=0 To 7
Language$(k) = ReadString(0)
Next
EndIf
CloseFile(0)
EndIf
EndProcedure
Restore BaseLanguage
For k=0 To 7
Read Language$(k)
Next
DataSection
BaseLanguage:
Data$ "File"
Data$ "Print"
Data$ "Quit"
Data$ "Field"
Data$ "OK"
Data$ "test"
Data$ "hallo"
Data$ "Cancel"
EndDataSection
Open_Window_0()
Repeat ; Start of the event loop
Event = WaitWindowEvent() ; This line waits until an event is received from Windows
WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadget() ; Is it a gadget event?
EventType = EventType() ; The event type
;You can place code here, and use the result as parameters for the procedures
If Event = #PB_Event_Menu
MenuID = EventMenu()
If MenuID = #MENU_1
Debug "GadgetID: #MENU_1"
ElseIf MenuID = #MENU_2
Debug "GadgetID: #MENU_2"
EndIf
EndIf
If Event = #PB_Event_Gadget
If GadgetID = #Button_0
ElseIf GadgetID = #Button_1
EndIf
EndIf
Until Event = #PB_Event_CloseWindow ; End of the event loop
End
;
The new Visual Designer 4 is almost ready to do a public alpha test release.