Page 1 of 3

gDesign - Visual Gadget Designer

Posted: Sun Oct 30, 2005 9:58 pm
by Mischa
gDesign (beta)

I've playing around with gadgets the last days.

gDesign is a very simple visual Designer.
Only gadgets will be processed, not statusbars, toolbars, or window menus.

Why another visual designer?

Very easy:

A gDesign file is an isolated layout block, so you can edit it all the time!
You can open more than one layout at the same time in your application.
This is the main difference to other visual designers.
The other one is the ability to add gadgets to scrollareas
and panelgadgets.

You will only need a small .pbi include-file to use layouts in your codes.


Please take a look:

Download:
http://www.thinkrelative.de/gdesign.zip

..and please tell me what you think.

Two examples included and a tool to associate extension with gDesign.
And take a look in ReadMe.txt to learn how to use gDesign. Easy.

Regards,
Mischa

Posted: Sun Oct 30, 2005 10:44 pm
by Droopy
Very very good misha :D

Can you add Copy and Paste for gadgets ?

Posted: Sun Oct 30, 2005 11:20 pm
by Mischa
An equal solution to copy/paste exists:

gDesign remembers last size and style of any gadget type
you have created or marked/changed.

For example you clicked on a ButtonGadget
Then unmark and press 'B' followed by 'U' and
a new ButtonGadget with same size and style will
be created at mouse position.

Regards,
Mischa

Posted: Sun Oct 30, 2005 11:26 pm
by srod
This is amazing. How long did this take -if you don't mind me asking?

Simple to use, to understand. Can even see how you've laid it all out.

I'll certainly be making good use of this.

Thanks for sharing.

Posted: Sun Oct 30, 2005 11:34 pm
by Droopy
Mischa wrote:gDesign remembers last size and style of any gadget type
you have created or marked/changed.
Thanks I discover this usefull function after my post. :D

It's very easy and fast to create visual design with this tool. :P

It is possible to give a Constant for Gadgets, so i can use #Button0 instead of ItemIndex(7) :?:

Posted: Sun Oct 30, 2005 11:49 pm
by Mischa
@srod
Hm, if we subtract the time for (stupid) bug searching.
Result = about 1 week.

I know, i know, very long.
But i have a concentration problem the last few weeks.

This is also the reason, why I made that here.
It's just a break of my big project and substantially more simply.

@all
But i'm happy, if you like it. 8)

@Droopy
I will take a look next days. :wink:

Regards,
Mischa

Posted: Mon Oct 31, 2005 12:08 am
by Mischa
@Droopy

Hm, i thought about what you've asked.

It's a dynamic system, so you can't use #Button0 only.
A solution could be for example

Code: Select all

Select EventGadgetId()
    Case Item(#Button0)
    ...
EndSelect
or

Code: Select all

Select EventGadgetId()
    Case Gadget(#Button0)
    ...
EndSelect
or

Code: Select all

Select EventGadgetId()
    Case gMem+#Button0
    ...
EndSelect
The problem is the GadgetID table.
You must use an array, or memory, or similar target
to receive IDs.

gDesign could create a source with constants.
But what about using more than one layout in same code.
This could be a bit harder.

Hm, i will think about it.

Posted: Mon Oct 31, 2005 7:01 am
by Droopy
Ts-soft ha posted a version you can compile with tailbite in the German forum.


Code: Select all

ProcedureDLL gDesignInit() 
  ;This is the init stuff 
  Structure gdescontent 
    id.l 
    number.w 
    x.l 
    y.l 
    w.l 
    h.l 
    para1.l 
    para2.l 
    para3.l 
    flags.l 
    typ.l 
    wtext.s 
    gpo.l 
  EndStructure 
  
  Global gDesValue.gdescontent 
  NewList gDesParent.l() 
  
  Dim gDesignTyp.b(24) 
  Restore gdestyp : For i=1 To 24 : Read gDesignTyp(i) : Next i 
  DataSection 
  gdestyp: Data.b 3,0,3,2,2,3,3,3,3,3,2,7,0,1,0,14,30,30,12,3,3,14,2,1 
  EndDataSection 
  ;End of init 
EndProcedure 

Procedure ReCreateObject() 
  Select gDesValue\typ 
    Case 1:gDesValue\id=ButtonGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 2:gDesValue\id=ButtonImageGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,0) 
    Case 3:gDesValue\id=CheckBoxGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 4:gDesValue\id=ComboBoxGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\flags) 
    Case 5:gDesValue\id=EditorGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\flags)  
    Case 6:gDesValue\id=ExplorerComboGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 7:gDesValue\id=ExplorerListGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 8:gDesValue\id=ExplorerTreeGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags)  
    Case 9:gDesValue\id=Frame3DGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 10:gDesValue\id=HyperLinkGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags)  
    Case 11:gDesValue\id=ImageGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,0,gDesValue\flags)  
    Case 12:gDesValue\id=ListIconGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\para1,gDesValue\flags) 
    Case 13:gDesValue\id=ListViewGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h)  
    Case 14:gDesValue\id=OptionGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext) 
    Case 15:gDesValue\id=PanelGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h) 
    Case 16:gDesValue\id=ProgressBarGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\para1,gDesValue\para2,gDesValue\flags) 
    Case 17:gDesValue\id=ScrollAreaGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\para1,gDesValue\para2,gDesValue\para3,gDesValue\flags) 
    Case 18:gDesValue\id=ScrollBarGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\para1,gDesValue\para2,gDesValue\para3,gDesValue\flags)  
    Case 19:gDesValue\id=SpinGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\para1,gDesValue\para2) 
    Case 20:gDesValue\id=StringGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 21:gDesValue\id=TextGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 22:gDesValue\id=TrackBarGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\para1,gDesValue\para2,gDesValue\flags) 
    Case 23:gDesValue\id=TreeGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\flags) 
    Case 24:gDesValue\id=WebGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext) 
  EndSelect 
EndProcedure 

ProcedureDLL  gDesignClientWidth(*gdata) 
  ProcedureReturn PeekL(*gdata+4) 
EndProcedure 

ProcedureDLL gDesignClientHeight(*gdata) 
  ProcedureReturn PeekL(*gdata+8) 
EndProcedure 

ProcedureDLL gDesignMaxItem(*gdata) 
  ProcedureReturn PeekL(*gdata)-1 
EndProcedure 

ProcedureDLL gDesign(*gdata,*gitems,goffx,goffy) 
  gcount=PeekL(*gdata+12):gDesValue\gpo=16 
  For i=1 To gcount 
    gDesValue\typ=PeekB(*gdata+gDesValue\gpo):gDesValue\gpo+1 
    gDesValue\number=PeekW(*gdata+gDesValue\gpo):gDesValue\gpo+2 
    If gDesValue\typ=100 
      ptext.s=PeekS(*gdata+gDesValue\gpo):gDesValue\gpo+Len(ptext)+1 
      AddGadgetItem(gDesParent(),-1,ptext) 
    ElseIf gDesValue\typ=0 
      CloseGadgetList() 
      DeleteElement(gDesParent()) 
    Else 
      gDesValue\x=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      gDesValue\y=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      gDesValue\w=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      gDesValue\h=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      If gDesignTyp(gDesValue\typ) & 1 
        gDesValue\wtext=PeekS(*gdata+gDesValue\gpo):gDesValue\gpo+Len(gDesValue\wtext)+1 
      EndIf 
      If gDesignTyp(gDesValue\typ) & 2 
        gDesValue\flags=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      EndIf 
      If gDesignTyp(gDesValue\typ) & 4 
        gDesValue\para1=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      EndIf 
      If gDesignTyp(gDesValue\typ) & 8 
        gDesValue\para2=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      EndIf 
      If gDesignTyp(gDesValue\typ) & 16 
        gDesValue\para3=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      EndIf 
      If CountList(gDesParent())=0 
        gDesValue\x+goffx 
        gDesValue\y+goffy 
      EndIf 
      ReCreateObject() 
      PokeL(*gitems+gDesValue\number*4,gDesValue\id) 
      If gDesValue\typ=15 
        AddElement(gDesParent()) 
        gDesParent()=gDesValue\id 
      ElseIf gDesValue\typ=17 
        AddElement(gDesParent()) 
        gDesParent()=gDesValue\id 
      EndIf  
    EndIf 
  Next 
  ClearList(gDesParent()) 
  While WindowEvent():Wend 
EndProcedure 

Posted: Mon Oct 31, 2005 7:12 am
by Droopy
Mischa wrote: The problem is the GadgetID table.
You must use an array, or memory, or similar target
to receive IDs.

gDesign could create a source with constants.
But what about using more than one layout in same code.
This could be a bit harder.
Just a ClipBoard data i can paste in my main code --> It's great with JaPBe autocompletition ! :wink:

Code: Select all

Enumeration ;/ Gdesign Gadgets
  #ButtonOK
  #ButtonCancel
  #StringIP
  #CloseButton
endEnumeration
Thanks

Posted: Mon Oct 31, 2005 8:37 am
by benny
@Mischa:

Damn ... just downloaded your tool and had a quick go with it :!: It looks
awesome. Great work as allways. Thanks for sharing.

Posted: Mon Oct 31, 2005 9:37 am
by Mischa
Still another remark:

Some gadgets need 'double' right click to show their
style flag menu.

But i think, you will easy find out, how it works. :wink:

Regards,
Mischa

Posted: Mon Oct 31, 2005 11:19 am
by Droopy
The same lib without need of init function

Code: Select all

;Author: Mischa / ts-soft for Library Purpose

Procedure gDesignInit() 
  Static init.l
  
  Structure gdescontent 
    id.l 
    number.w 
    x.l 
    y.l 
    w.l 
    h.l 
    para1.l 
    para2.l 
    para3.l 
    flags.l 
    typ.l 
    wtext.s 
    gpo.l 
  EndStructure 
  
  If init=0
    Global gDesValue.gdescontent 
    NewList gDesParent.l() 
    Dim gDesignTyp.b(24) 
    Restore gdestyp : For i=1 To 24 : Read gDesignTyp(i) : Next i 
    init=1
  EndIf
  
  DataSection 
  gdestyp: Data.b 3,0,3,2,2,3,3,3,3,3,2,7,0,1,0,14,30,30,12,3,3,14,2,1 
  EndDataSection 
EndProcedure 

Procedure ReCreateObject() 
  Select gDesValue\typ 
    Case 1:gDesValue\id=ButtonGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 2:gDesValue\id=ButtonImageGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,0) 
    Case 3:gDesValue\id=CheckBoxGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 4:gDesValue\id=ComboBoxGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\flags) 
    Case 5:gDesValue\id=EditorGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\flags)  
    Case 6:gDesValue\id=ExplorerComboGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 7:gDesValue\id=ExplorerListGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 8:gDesValue\id=ExplorerTreeGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags)  
    Case 9:gDesValue\id=Frame3DGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 10:gDesValue\id=HyperLinkGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags)  
    Case 11:gDesValue\id=ImageGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,0,gDesValue\flags)  
    Case 12:gDesValue\id=ListIconGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\para1,gDesValue\flags) 
    Case 13:gDesValue\id=ListViewGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h)  
    Case 14:gDesValue\id=OptionGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext) 
    Case 15:gDesValue\id=PanelGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h) 
    Case 16:gDesValue\id=ProgressBarGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\para1,gDesValue\para2,gDesValue\flags) 
    Case 17:gDesValue\id=ScrollAreaGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\para1,gDesValue\para2,gDesValue\para3,gDesValue\flags) 
    Case 18:gDesValue\id=ScrollBarGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\para1,gDesValue\para2,gDesValue\para3,gDesValue\flags)  
    Case 19:gDesValue\id=SpinGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\para1,gDesValue\para2) 
    Case 20:gDesValue\id=StringGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 21:gDesValue\id=TextGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext,gDesValue\flags) 
    Case 22:gDesValue\id=TrackBarGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\para1,gDesValue\para2,gDesValue\flags) 
    Case 23:gDesValue\id=TreeGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\flags) 
    Case 24:gDesValue\id=WebGadget(#PB_Any,gDesValue\x,gDesValue\y,gDesValue\w,gDesValue\h,gDesValue\wtext) 
  EndSelect 
EndProcedure 

ProcedureDLL  gDesignClientWidth(*gdata) 
  ProcedureReturn PeekL(*gdata+4) 
EndProcedure 

ProcedureDLL gDesignClientHeight(*gdata) 
  ProcedureReturn PeekL(*gdata+8) 
EndProcedure 

ProcedureDLL gDesignMaxItem(*gdata) 
  gDesignInit()
  ProcedureReturn PeekL(*gdata)-1 
EndProcedure 

ProcedureDLL gDesign(*gdata,*gitems,goffx,goffy) 
  gcount=PeekL(*gdata+12):gDesValue\gpo=16 
  For i=1 To gcount 
    gDesValue\typ=PeekB(*gdata+gDesValue\gpo):gDesValue\gpo+1 
    gDesValue\number=PeekW(*gdata+gDesValue\gpo):gDesValue\gpo+2 
    If gDesValue\typ=100 
      ptext.s=PeekS(*gdata+gDesValue\gpo):gDesValue\gpo+Len(ptext)+1 
      AddGadgetItem(gDesParent(),-1,ptext) 
    ElseIf gDesValue\typ=0 
      CloseGadgetList() 
      DeleteElement(gDesParent()) 
    Else 
      gDesValue\x=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      gDesValue\y=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      gDesValue\w=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      gDesValue\h=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      If gDesignTyp(gDesValue\typ) & 1 
        gDesValue\wtext=PeekS(*gdata+gDesValue\gpo):gDesValue\gpo+Len(gDesValue\wtext)+1 
      EndIf 
      If gDesignTyp(gDesValue\typ) & 2 
        gDesValue\flags=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      EndIf 
      If gDesignTyp(gDesValue\typ) & 4 
        gDesValue\para1=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      EndIf 
      If gDesignTyp(gDesValue\typ) & 8 
        gDesValue\para2=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      EndIf 
      If gDesignTyp(gDesValue\typ) & 16 
        gDesValue\para3=PeekL(*gdata+gDesValue\gpo):gDesValue\gpo+4 
      EndIf 
      If CountList(gDesParent())=0 
        gDesValue\x+goffx 
        gDesValue\y+goffy 
      EndIf 
      ReCreateObject() 
      PokeL(*gitems+gDesValue\number*4,gDesValue\id) 
      If gDesValue\typ=15 
        AddElement(gDesParent()) 
        gDesParent()=gDesValue\id 
      ElseIf gDesValue\typ=17 
        AddElement(gDesParent()) 
        gDesParent()=gDesValue\id 
      EndIf  
    EndIf 
  Next 
  ClearList(gDesParent()) 
  While WindowEvent():Wend 
EndProcedure 
[/quote]

Posted: Mon Oct 31, 2005 11:26 am
by thefool
Looks nice! However a small bug: When a frame is created, it cant be selected after another object has been selected.

Posted: Mon Oct 31, 2005 12:08 pm
by Mischa
@thefool

It's not a bug, it's a feature. :wink:

When you want create gadgets inside frame, you will mark this
everytime you right click at this position.

So, frames have an extra layer.

You can mark them by clicking like other gadgets,
but you have to press and hold SHIFT key, too.

I have wrote this in the ReadMe.

Regards,
Mischa

Posted: Mon Oct 31, 2005 12:10 pm
by thefool
:shock:
i better read those files before complaining :)