PureFORM 1.99 (yet another FORM designer)

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update

Changes :
You can now choose to replace the PureCOLOR functions with the genuine Purebasic V4 coloring functions in the generated code. PureFORM will continue to use PureCOLOR internally.
Please note that :
- this feature is only available for PB4 compatible code (PB3.94 doesn't support gadget coloring)
- PureCOLOR supports more gadget classes than the genuine PB4 functions and adds some extra features, so be aware that you may loose some features if you activate the PureCOLOR / PB4 function switch.
See the new 'Color functions' tab in the 'Preferences' dialog.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
michel
Enthusiast
Enthusiast
Posts: 142
Joined: Mon Feb 19, 2007 5:47 pm
Location: Luxemburg

custom gadgets

Post by michel »

Hello Gnozal,

I want to use the "custom gadget" place mechanism to call a bargraph drawing subroutine. This works perfectly good but I need an additional parameter (text2 for example). With this string I could change the behaviour of that routine.
In order to give you an idea what I am doing here my test code:

Procedure H_Bargraph(Nr,x,y,xw,yh,txt.s)
If CreateImage(Nr, xw, yh)
If StartDrawing(ImageOutput(Nr))
FontID1.l = LoadFont(1, "Courier New", 8, #PB_Font_Bold | #PB_Font_HighQuality)
; Background Box
Box(0,0,xw,yh,RGB(232,232,232))
; unterer Grenzwert rot
Box(5,0,40,6,RGB(255,0,0))
; oberer Grenzwert rot
Box(145,0,60,6,RGB(255,0,0))
; Messwert einzeichnen
If Value >= 0
Box(5,6,135,10,RGB(0,140,0))
EndIf
; Box-Umrandung zeichnen
LineXY(5,0,205,0,RGB(0,0,0))
LineXY(5,0,5,20,RGB(0,0,0))
LineXY(205,0,205,20,RGB(0,0,0))
LineXY(5,15,205,15,RGB(0,0,0))
DrawingMode(1)
; Lineal zeichnen
DrawingFont(FontID1)
startscale=19
LineXY(5,15,5,20,RGB(255,0,255))
DrawText(0,25,Str(startscale))
For i=1 To 10
LineXY(i*20+5,15,i*20+5,20,RGB(255,0,255))
DrawText(i*20-2,25,Str(startscale+i))
Next
StopDrawing()
EndIf
EndIf
ImageGadget(Nr, x, y, xw, yh, ImageID(Nr))
EndProcedure

;{- Enumerations / DataSections
;:PureFORM:Init:Start:
; PureFORM V1.65 ~ 30.04.2007 17:49:47
;{ Windows
Enumeration
#Window_0
EndEnumeration
;}
;{ Gadgets
Enumeration
#Custom_1
#Custom_4
#Custom_5
EndEnumeration
;}
;{ MultiLanguage support
Enumeration
#Window_0_W_Lng
;
#Custom_1_Lng
#Custom_4_Lng
#Custom_5_Lng
EndEnumeration
#MaxLanguageItems = #PB_Compiler_EnumerationValue - 1
;{ Default language items
DataSection ;>
DefaultLanguage:
Data.s "Window_0"
;
Data.s ""
Data.s "Gadget_4"
Data.s "Gadget_5"
EndDataSection ;<
;}
Global Dim LanguageItem.s(#MaxLanguageItems)
; Load default language
Restore DefaultLanguage
For LanguageItemIdx = 0 To #MaxLanguageItems
Read LanguageItem(LanguageItemIdx)
Next
; Load language catalog
Procedure ReadLanguageFile(Catalog.s) ; Read language file
Protected Stream.l, LanguageItemIdx.l
Stream = ReadFile(#PB_Any, Catalog)
If Stream
While Eof(Stream) = #False
LanguageItem(LanguageItemIdx) = ReadString(Stream)
LanguageItemIdx + 1
If LanguageItemIdx > #MaxLanguageItems
Break
EndIf
Wend
CloseFile(Stream)
EndIf
EndProcedure
;}
;:PureFORM:Init:End:
;}
;:PureFORM:Windows:Start:
;:PureFORM:Window_0_1:Start:
Procedure OpenWindow_Window_0()
If OpenWindow(#Window_0, 201, 134, 619, 400, LanguageItem(#Window_0_W_Lng), #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
If CreateGadgetList(WindowID(#Window_0))
H_Bargraph(#Custom_1, 100, 50, 215, 40, LanguageItem(#Custom_1_Lng))
H_Bargraph(#Custom_4, 100, 100, 215, 40, LanguageItem(#Custom_4_Lng))
H_Bargraph(#Custom_5, 100, 150, 215, 40, LanguageItem(#Custom_5_Lng))
;:PureFORM:Window_0_1:End:
; Your code here ...

;
;:PureFORM:Window_0_2:Start:
EndIf
EndIf
EndProcedure
;:PureFORM:Window_0_2:End:
;:PureFORM:Windows:End:
;
;:PureFORM:Gadgets:Start:
;:PureFORM:Gadget_1_1:Start:
Procedure Custom_1_OnEvent(EventType.l)
Debug "test"
;:PureFORM:Gadget_1_1:End:
; Your code here ...

;
;:PureFORM:Gadget_1_2:Start:
EndProcedure
;:PureFORM:Gadget_1_2:End:
;:PureFORM:Gadgets:End:

OpenWindow_Window_0()
;:PureFORM:Main:Start:
;:PureFORM:Main:End:

;{- Event loop
Repeat
Event = WaitWindowEvent()

;:PureFORM:Loop:Start:
Select Event
; ///////////////////
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #Custom_1
Custom_1_OnEvent(EventType)
ElseIf EventGadget = #Custom_4
ElseIf EventGadget = #Custom_5
EndIf
; //////////////////////
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #Window_0
CloseWindow(#Window_0)
Break
EndIf
EndSelect
;:PureFORM:Loop:End:

Delay(1)
ForEver
;
;:PureFORM:AfterLoop:Start:
;:PureFORM:AfterLoop:End:
;}

Would it be possible to add this parameter ?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: custom gadgets

Post by gnozal »

michel wrote:Hello Gnozal,
I want to use the "custom gadget" place mechanism to call a bargraph drawing subroutine. This works perfectly good but I need an additional parameter (text2 for example). With this string I could change the behaviour of that routine.
Would it be possible to add this parameter ?
You mean something like H_Bargraph(Nr,x,y,xw,yh,txt.s, TEXT2.s) ?
OK, will see ...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
michel
Enthusiast
Enthusiast
Posts: 142
Joined: Mon Feb 19, 2007 5:47 pm
Location: Luxemburg

custom gadget

Post by michel »

Hello Gnozal,

That's exactly what I had in mind. :D

By the way I discovered that you can fix in the parameters the width and the height of an object but the graphic is not adjusted automatically. Do you mind it will be possible to adjust a user gadget representation by a prefixed value of the width, the height or both. :?:

sincerely Michel
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: custom gadget

Post by gnozal »

michel wrote: By the way I discovered that you can fix in the parameters the width and the height of an object but the graphic is not adjusted automatically. Do you mind it will be possible to adjust a user gadget representation by a prefixed value of the width, the height or both.
I am afraid I dont understand what you mean ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
michel
Enthusiast
Enthusiast
Posts: 142
Joined: Mon Feb 19, 2007 5:47 pm
Location: Luxemburg

custom gadget

Post by michel »

Hello Gnozal,

In the setup I determine the following parameters:

H_Bargraph(%id%, %x%, %y%, 215, 40, %text%)

So everytime I use this gadget I want to get the x and y coordinates but always a gadget with a width of 215 and a height of 40. That's OK, I get the code like that but the representation on screen varies. So I thought once positioned the gadget could readjust to the predefined length and height.

michel
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: custom gadget

Post by gnozal »

michel wrote:Hello Gnozal,
In the setup I determine the following parameters:
H_Bargraph(%id%, %x%, %y%, 215, 40, %text%)
So everytime I use this gadget I want to get the x and y coordinates but always a gadget with a width of 215 and a height of 40. That's OK, I get the code like that but the representation on screen varies. So I thought once positioned the gadget could readjust to the predefined length and height.
michel
I am afraid this is currently not possible. The custom gadget is handled like any other gadget, the only difference is that during code generation the mask defined by the user is used.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update

Changes :
- added extra parameter for custom gadgets
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
michel
Enthusiast
Enthusiast
Posts: 142
Joined: Mon Feb 19, 2007 5:47 pm
Location: Luxemburg

custom gadget

Post by michel »

Hello Gnozal,

:D :D :D Great !
Thank you

Michel
Molchyn
User
User
Posts: 42
Joined: Thu Jan 29, 2004 12:54 am

Post by Molchyn »

gnozal
With compiler directive EnableExplicit
it's ask about declaration not explicitly declared variables like
Event,EventGadget,EventType,EventWindow....etc
Maybe need add a chekmark in F12 menu?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Molchyn wrote:gnozal
With compiler directive EnableExplicit
it's ask about declaration not explicitly declared variables like
Event,EventGadget,EventType,EventWindow....etc
Maybe need add a chekmark in F12 menu?
You mean something like

Code: Select all

Define.l EventGadget, EventType, ...
placed in the enumeration section ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Molchyn
User
User
Posts: 42
Joined: Thu Jan 29, 2004 12:54 am

Post by Molchyn »

yep
maw

Post by maw »

Bugreport for 1.65 166

Sorry if this is a known bug/feature, but I couldn't find anything searching and I am not about to read through 32 pages of text to find out manually :)

Create a panelgadet. Populate the tab with a few gadgets. Create a second tab, populate it with a few gadgets. Then delete the second tab. The second tab is removed with all it's gadgets, but also all gadgets on the first tab is removed. Same thing happens if you have more tabs, all gadgets of all remaining tabs are removed when removing a tab.

Btw, thanks alot for your hard work!! PureFORM is simply amazing!!!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update

Changes :
- the few variables used in the event loop are now defined in the generated code
- fixed 'delete PanelGadget tab' bug
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
michel
Enthusiast
Enthusiast
Posts: 142
Joined: Mon Feb 19, 2007 5:47 pm
Location: Luxemburg

Program comment line

Post by michel »

Hello Gnozal,

Since a while I observe a numbering problem with the program comment line especially if a window has been deleted:

Code: Select all

;:PureFORM:Window_10_1:Start:
Procedure OpenWindow_Window_11()
Correcting the line :

Code: Select all

;:PureFORM:Window_10_1:Start:
to

Code: Select all

;:PureFORM:Window_11_1:Start:
makes no sense because the error reappears as soon as the code is updated :(

michel
Post Reply