Gui Builder as Editor feature?
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
Thanks the Beck, i reply your email.
The idea is to add to the editor itself a menu option that let the user open a gui builder.
This gui builder will show the gadgets of the actual code on the idea and let the user add/delete/resize/drag them
of course the user can start a new blank code designing first the gui.
I just have an example that resizes/drag a button but since the principle is almost the same for every gadget, we can codeit in a few days ( i hope). The idea of the example is just to show how a gadget can be easily draged/resized using PB code...
http://www.getafile.com/cgi-bin/merlot/ ... UILDER.zip
This is NOT any test or anything, is just asking other to join the project or give ideas.
Best Regards
Ricardo
Dont cry for me Argentina...
Thanks the Beck, i reply your email.
The idea is to add to the editor itself a menu option that let the user open a gui builder.
This gui builder will show the gadgets of the actual code on the idea and let the user add/delete/resize/drag them
of course the user can start a new blank code designing first the gui.
I just have an example that resizes/drag a button but since the principle is almost the same for every gadget, we can codeit in a few days ( i hope). The idea of the example is just to show how a gadget can be easily draged/resized using PB code...
http://www.getafile.com/cgi-bin/merlot/ ... UILDER.zip
This is NOT any test or anything, is just asking other to join the project or give ideas.
Best Regards
Ricardo
Dont cry for me Argentina...
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Berikco.
Whoohoo...cool, i can't wait to see it
Regards,
Berikco
http://www.benny.zeb.be/purebasic.htm
Whoohoo...cool, i can't wait to see it

Regards,
Berikco
http://www.benny.zeb.be/purebasic.htm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
WOWWWWWWWWWWW
A BIG NEWS TO THE PB COMMUNITY!!!
CONGRATULLATIONS FRED FOR DOING THAT.
Best Regards
Ricardo
Dont cry for me Argentina...
Originally posted by fred
A visual designer written in PureBasic is actually in final stage of development and should be released with PB 3.60, so you could may be wait a bit to see if it fits your needs.
Fred - AlphaSND
WOWWWWWWWWWWW
A BIG NEWS TO THE PB COMMUNITY!!!
CONGRATULLATIONS FRED FOR DOING THAT.
Best Regards
Ricardo
Dont cry for me Argentina...
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
Here is a little snippet that let resize and drag a button. I continue coding it just for fun and for learning purpouse...
;GUI DESIGNER - Ricardo Arias
;
;
;
;1.- Detects if ANY gadget receives a click (there are some flat gadgets that dont receive it directly have to work on it)
;2.- Paint the resize handles or points over the selected gadget
;3.- Drag every gadget (the same problem with flat gadgets)
;4.- Detect when a resize point has the mouse over
;5.- Properly calculate the new dimension of the gadget once its resized (now its buggy but only because im lazy)
;6.- Generate the PB code (its easy but not done yet!)
;
;It can handle many gadgets but have troubles with two kind of gadgets:
;a) flat gadgets
;b) Gadgets like tree, combo, etc.
;need to find a workaround this
#WindowStyle = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget
Global Painted.l ;We can know if some gadget has the points painted
Global Selected.l
Structure Objetos
x1.l
y1.l
x2.l
y2.l
x3.l
y3.l
x4.l
y4.l
num.l
EndStructure
Dim Object.Objetos(1)
Procedure Crea(num.l,posx.l,posy.l);This procedure pain the small points
Selected = 1
StartDrawing(WindowOutput())
Box(posx,posy,7,7,0)
StopDrawing()
Painted = 1
EndProcedure
Procedure Clear_screen()
b.RECT
b\right=WindowWidth()
b\bottom=WindowHeight()
InvalidateRect_(WindowID(),@b,1)
sendmessage_(WindowID(),#WM_PAINT,0,0)
Painted.l = 0
EndProcedure
Procedure ResizeBoxs(control.l)
Clear_screen()
x1.l = GadgetX(control)-5
y1.l = GadgetY(control)-5
Crea(control,x1,y1)
x2.l = (GadgetX(control) + GadgetWidth(control)-5)+5
y2.l = GadgetY(control)-5
Crea(control,x2,y2)
x3.l = GadgetX(control) -5
y3.l = (GadgetY(control) + GadgetHeight(control)-5)+5
Crea(control,x3,y3)
x4.l = (GadgetX(control) + GadgetWidth(control)-5 )+5
y4.l = (GadgetY(control) + GadgetHeight(control)-5)+5
Crea(control,x4,y4)
object(1)\x1 = x1
object(1)\y1 = y1
object(1)\x2 = x2
object(1)\y2 = y2
object(1)\x3 = x3
object(1)\y3 = y3
object(1)\x4 = x4
object(1)\y4 = y4
object(1)\num = control
EndProcedure
If OpenWindow(0,10,10,550,500,#WindowStyle,"VisualGUI - now we can resize and drag buttons")
CreateGadgetList(WindowID())
If CreatePopupMenu(0);-Menu
MenuItem(1, "ButtonGadget")
EndIf
MessageRequester("","RIGHT CLICK TO SELECT THE GADGET TO CREATE... NOW ONLY CREATE DRAG AND RESIZE BUTTONS... BUT THE PRINCIPLE IS THE SAME FOR EVERY GADGET",0)
Repeat
EventID=WaitWindowEvent()
Select EventID
Case #WM_RButtonDown
;Store where was the click to create a button
WinX = WindowMouseX()-5
WinY = WindowMouseY()-30
DisplayPopupMenu(0, WindowID())
Case #WM_LBUTTONDOWN
;We get the handle of the gadget that receives the click
GetCursorPos_(mouse.POINT)
Handle = 0
For i = 0 To Control
If WindowFromPoint_(mouse\x,mouse\y) = GadgetID(i)
Handle.l = GadgetID(i)
IDgadget.l = i ;The number of the Gadget
EndIf
Next i
If Handle = 0;If the click was on the window and not in any gadget
;then we deselect any selected gadget
Clear_screen()
EndIf
If Resizing = 0
Selected = 0 ;No points if no control selected
If Painted = 1;
Clear_screen()
Painted = 0
EndIf
Else
Which = Resizing;We know if some point will be resized
EndIf
Case #WM_MOUSEMOVE
;Lets move the gadget
If Handle
ReleaseCapture_()
SendMessage_(Handle, #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
EndIf
;**************** HACE RESIZE
;-HaceResize
If Which
If Painted = 1;Borra los puntitos
Clear_screen()
EndIf
Select Which;Aca sabe cual de los 4 puntitos es el que va a ser resizeado
Case 1
If OldHeight = 0
OldHeight = GadgetHeight(object(1)\num)
EndIf
If object(1)\y1 > (WindowMouseY()-30)
CalcHeight.l = (object(1)\y1 - (WindowMouseY()-30)) + OldHeight
Else
If ((WindowMouseY()-30) - object(1)\y1) > OldHeight - 5
Goto otro
Else
CalcHeight.l = OldHeight - ((WindowMouseY()-30) - object(1)\y1)
EndIf
EndIf
If OldWidth = 0
OldWidth = GadgetWidth(object(1)\num)
EndIf
If object(1)\x1 > (WindowMouseX()-5)
CalcWidth.l = (object(1)\x1 - (WindowMouseX()-5)) + OldWidth
Else
If ((WindowMouseX()-5) - object(1)\x1) > OldWidth - 5
Goto otro
Else
CalcWidth.l = OldWidth - ((WindowMouseX()-5) - object(1)\x1)
EndIf
EndIf
ResizeGadget(object(1)\num, WindowMouseX()-5, WindowMouseY()-30, CalcWidth, CalcHeight)
;Pinta(WindowMouseX()-5, WindowMouseY()-30, CalcWidth, CalcHeight)
Case 2
If OldHeight = 0
OldHeight = GadgetHeight(object(1)\num)
EndIf
If object(1)\y1 > (WindowMouseY()-30)
CalcHeight.l = (object(1)\y1 - (WindowMouseY()-30)) + OldHeight
Else
If ((WindowMouseY()-30) - object(1)\y1) > OldHeight - 5
Goto otro
Else
CalcHeight.l = OldHeight - ((WindowMouseY()-30) - object(1)\y1)
EndIf
EndIf
If (WindowMouseX()-5)-object(1)\x1 (WindowMouseX()-5)
CalcWidth.l = (object(1)\x1 - (WindowMouseX()-5)) + OldWidth
Else
If ((WindowMouseX()-5) - object(1)\x1) > OldWidth - 5
Goto otro
Else
CalcWidth.l = OldWidth - ((WindowMouseX()-5) - object(1)\x1)
EndIf
EndIf
If (WindowMouseY()-30)-object(1)\y1 = (object(1)\x1-5) And WindowMouseX()-5 = (object(1)\y1-5) And WindowMouseY()-30 = (object(1)\x2-5) And WindowMouseX()-5 = (object(1)\y2-5) And WindowMouseY()-30= (object(1)\x3-5) And WindowMouseX()-5=(object(1)\y3-5) And WindowMouseY()-30= (object(1)\x4-5) And WindowMouseX()-5=(object(1)\y4-5) And WindowMouseY()-30 0;When release the mouse the gadget is redimesioned and the point repainted
Cont = Cont + 1
Which = 0
Clear_screen()
ResizeBoxs(IDGadget)
EndIf
Resizing = 0
Case #PB_EventMenu
Select EventMenuID()
Case 1
Control = Control + 1; The number of the gadget
ButtonGadget(control, WinX, WinY, 90, 30, "Button " + Str(control))
EndSelect
Case #PB_EventGadget
;-Event from a Button
Select EventGadgetID()
Case 0
Default
ResizeBoxs(EventGadgetID())
EndSelect
EndSelect
Until EventID = #PB_EventCloseWindow
EndIf
End
Best Regards
Ricardo
Dont cry for me Argentina...
Here is a little snippet that let resize and drag a button. I continue coding it just for fun and for learning purpouse...
;GUI DESIGNER - Ricardo Arias
;
;
;
;1.- Detects if ANY gadget receives a click (there are some flat gadgets that dont receive it directly have to work on it)
;2.- Paint the resize handles or points over the selected gadget
;3.- Drag every gadget (the same problem with flat gadgets)
;4.- Detect when a resize point has the mouse over
;5.- Properly calculate the new dimension of the gadget once its resized (now its buggy but only because im lazy)
;6.- Generate the PB code (its easy but not done yet!)
;
;It can handle many gadgets but have troubles with two kind of gadgets:
;a) flat gadgets
;b) Gadgets like tree, combo, etc.
;need to find a workaround this
#WindowStyle = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget
Global Painted.l ;We can know if some gadget has the points painted
Global Selected.l
Structure Objetos
x1.l
y1.l
x2.l
y2.l
x3.l
y3.l
x4.l
y4.l
num.l
EndStructure
Dim Object.Objetos(1)
Procedure Crea(num.l,posx.l,posy.l);This procedure pain the small points
Selected = 1
StartDrawing(WindowOutput())
Box(posx,posy,7,7,0)
StopDrawing()
Painted = 1
EndProcedure
Procedure Clear_screen()
b.RECT
b\right=WindowWidth()
b\bottom=WindowHeight()
InvalidateRect_(WindowID(),@b,1)
sendmessage_(WindowID(),#WM_PAINT,0,0)
Painted.l = 0
EndProcedure
Procedure ResizeBoxs(control.l)
Clear_screen()
x1.l = GadgetX(control)-5
y1.l = GadgetY(control)-5
Crea(control,x1,y1)
x2.l = (GadgetX(control) + GadgetWidth(control)-5)+5
y2.l = GadgetY(control)-5
Crea(control,x2,y2)
x3.l = GadgetX(control) -5
y3.l = (GadgetY(control) + GadgetHeight(control)-5)+5
Crea(control,x3,y3)
x4.l = (GadgetX(control) + GadgetWidth(control)-5 )+5
y4.l = (GadgetY(control) + GadgetHeight(control)-5)+5
Crea(control,x4,y4)
object(1)\x1 = x1
object(1)\y1 = y1
object(1)\x2 = x2
object(1)\y2 = y2
object(1)\x3 = x3
object(1)\y3 = y3
object(1)\x4 = x4
object(1)\y4 = y4
object(1)\num = control
EndProcedure
If OpenWindow(0,10,10,550,500,#WindowStyle,"VisualGUI - now we can resize and drag buttons")
CreateGadgetList(WindowID())
If CreatePopupMenu(0);-Menu
MenuItem(1, "ButtonGadget")
EndIf
MessageRequester("","RIGHT CLICK TO SELECT THE GADGET TO CREATE... NOW ONLY CREATE DRAG AND RESIZE BUTTONS... BUT THE PRINCIPLE IS THE SAME FOR EVERY GADGET",0)
Repeat
EventID=WaitWindowEvent()
Select EventID
Case #WM_RButtonDown
;Store where was the click to create a button
WinX = WindowMouseX()-5
WinY = WindowMouseY()-30
DisplayPopupMenu(0, WindowID())
Case #WM_LBUTTONDOWN
;We get the handle of the gadget that receives the click
GetCursorPos_(mouse.POINT)
Handle = 0
For i = 0 To Control
If WindowFromPoint_(mouse\x,mouse\y) = GadgetID(i)
Handle.l = GadgetID(i)
IDgadget.l = i ;The number of the Gadget
EndIf
Next i
If Handle = 0;If the click was on the window and not in any gadget
;then we deselect any selected gadget
Clear_screen()
EndIf
If Resizing = 0
Selected = 0 ;No points if no control selected
If Painted = 1;
Clear_screen()
Painted = 0
EndIf
Else
Which = Resizing;We know if some point will be resized
EndIf
Case #WM_MOUSEMOVE
;Lets move the gadget
If Handle
ReleaseCapture_()
SendMessage_(Handle, #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
EndIf
;**************** HACE RESIZE
;-HaceResize
If Which
If Painted = 1;Borra los puntitos
Clear_screen()
EndIf
Select Which;Aca sabe cual de los 4 puntitos es el que va a ser resizeado
Case 1
If OldHeight = 0
OldHeight = GadgetHeight(object(1)\num)
EndIf
If object(1)\y1 > (WindowMouseY()-30)
CalcHeight.l = (object(1)\y1 - (WindowMouseY()-30)) + OldHeight
Else
If ((WindowMouseY()-30) - object(1)\y1) > OldHeight - 5
Goto otro
Else
CalcHeight.l = OldHeight - ((WindowMouseY()-30) - object(1)\y1)
EndIf
EndIf
If OldWidth = 0
OldWidth = GadgetWidth(object(1)\num)
EndIf
If object(1)\x1 > (WindowMouseX()-5)
CalcWidth.l = (object(1)\x1 - (WindowMouseX()-5)) + OldWidth
Else
If ((WindowMouseX()-5) - object(1)\x1) > OldWidth - 5
Goto otro
Else
CalcWidth.l = OldWidth - ((WindowMouseX()-5) - object(1)\x1)
EndIf
EndIf
ResizeGadget(object(1)\num, WindowMouseX()-5, WindowMouseY()-30, CalcWidth, CalcHeight)
;Pinta(WindowMouseX()-5, WindowMouseY()-30, CalcWidth, CalcHeight)
Case 2
If OldHeight = 0
OldHeight = GadgetHeight(object(1)\num)
EndIf
If object(1)\y1 > (WindowMouseY()-30)
CalcHeight.l = (object(1)\y1 - (WindowMouseY()-30)) + OldHeight
Else
If ((WindowMouseY()-30) - object(1)\y1) > OldHeight - 5
Goto otro
Else
CalcHeight.l = OldHeight - ((WindowMouseY()-30) - object(1)\y1)
EndIf
EndIf
If (WindowMouseX()-5)-object(1)\x1 (WindowMouseX()-5)
CalcWidth.l = (object(1)\x1 - (WindowMouseX()-5)) + OldWidth
Else
If ((WindowMouseX()-5) - object(1)\x1) > OldWidth - 5
Goto otro
Else
CalcWidth.l = OldWidth - ((WindowMouseX()-5) - object(1)\x1)
EndIf
EndIf
If (WindowMouseY()-30)-object(1)\y1 = (object(1)\x1-5) And WindowMouseX()-5 = (object(1)\y1-5) And WindowMouseY()-30 = (object(1)\x2-5) And WindowMouseX()-5 = (object(1)\y2-5) And WindowMouseY()-30= (object(1)\x3-5) And WindowMouseX()-5=(object(1)\y3-5) And WindowMouseY()-30= (object(1)\x4-5) And WindowMouseX()-5=(object(1)\y4-5) And WindowMouseY()-30 0;When release the mouse the gadget is redimesioned and the point repainted
Cont = Cont + 1
Which = 0
Clear_screen()
ResizeBoxs(IDGadget)
EndIf
Resizing = 0
Case #PB_EventMenu
Select EventMenuID()
Case 1
Control = Control + 1; The number of the gadget
ButtonGadget(control, WinX, WinY, 90, 30, "Button " + Str(control))
EndSelect
Case #PB_EventGadget
;-Event from a Button
Select EventGadgetID()
Case 0
Default
ResizeBoxs(EventGadgetID())
EndSelect
EndSelect
Until EventID = #PB_EventCloseWindow
EndIf
End
Best Regards
Ricardo
Dont cry for me Argentina...
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by gnozal.
I found an interesting form editor on the german forum :
http://www.shadow-studios.net/phpBB/vie ... php?t=1526
It's name is V_Tool (author is t-master) and you can download it at :
http://www.ewetel.net/~doris.gilbers
I think it's one of the best freeware form designers so far !
I found an interesting form editor on the german forum :
http://www.shadow-studios.net/phpBB/vie ... php?t=1526
It's name is V_Tool (author is t-master) and you can download it at :
http://www.ewetel.net/~doris.gilbers
I think it's one of the best freeware form designers so far !
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
Best Regards
Ricardo
Dont cry for me Argentina...
Excelent!!!!!!!!!!!Originally posted by gnozal
I found an interesting form editor on the german forum :
http://www.shadow-studios.net/phpBB/vie ... php?t=1526
It's name is V_Tool (author is t-master) and you can download it at :
http://www.ewetel.net/~doris.gilbers
I think it's one of the best freeware form designers so far !
Best Regards
Ricardo
Dont cry for me Argentina...
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by gnozal.
Just for information :
A new version (0.29) of V_Tool is at http://www.ewetel.net/~doris.gilbers
Just for information :
A new version (0.29) of V_Tool is at http://www.ewetel.net/~doris.gilbers