It is currently Wed Jun 19, 2013 2:14 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Upgrade from GTK 2 to GTK 3
PostPosted: Mon Jan 09, 2012 5:16 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Oct 22, 2003 2:51 am
Posts: 734
Location: Canada
Hello everyone,

This wishlist is more for Linux than anything else, anyway ...

    1. Upgrade from GTK 2 to GTK 3 for the Gadget library will be nice.
    2. Add GtkSwitch Gadget
    3. Add GtkSpinner Gadget

Maybe for PB V4.70.

Best regards.
Guimauve


Top
 Profile  
 
 Post subject: Re: Upgrade from GTK 2 to GTK 3
PostPosted: Mon Jan 09, 2012 6:06 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jun 06, 2005 2:35 pm
Posts: 594
Location: germany
+1

But I like to see a cross-platform layouting engine, too. It is annoying to create linux programs that most times looking like crap on other systems because the size of the gadgets, fonts, frames etc. is not the same than on yours...

Kukulkan

_________________
When somebody says "Expect the unexpected" slap them in the face and say" You didn’t expect that, did you?"


Top
 Profile  
 
 Post subject: Re: Upgrade from GTK 2 to GTK 3
PostPosted: Mon Jan 09, 2012 6:27 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Oct 22, 2003 2:51 am
Posts: 734
Location: Canada
Kukulkan wrote:
But I like to see a cross-platform layouting engine, too. It is annoying to create linux programs that most times looking like crap on other systems because the size of the gadgets, fonts, frames etc. is not the same than on yours


This will be impossible just because End-Users can change the system default font. So the GUI look will change from one platform to the other. For example on Windows, I can be wrong, the default Font is "Trebuchet MS", on Linux Mint 12, I use "Mint Spirit" as default font.

So my program don't have the same look on Windows and on Linux. Sending the font you use for your GUI along with your program is the only way out.

Best regards
Guimauve


Top
 Profile  
 
 Post subject: Re: Upgrade from GTK 2 to GTK 3
PostPosted: Mon Jan 09, 2012 8:18 pm 
Offline
Always Here
Always Here
User avatar

Joined: Mon Sep 22, 2003 6:45 pm
Posts: 7304
Location: Norway
Guimauve wrote:
Kukulkan wrote:
But I like to see a cross-platform layouting engine, too. It is annoying to create linux programs that most times looking like crap on other systems because the size of the gadgets, fonts, frames etc. is not the same than on yours


This will be impossible just because End-Users can change the system default font. So the GUI look will change from one platform to the other. For example on Windows, I can be wrong, the default Font is "Trebuchet MS", on Linux Mint 12, I use "Mint Spirit" as default font.
He wants gadgets to scale automatically with the font size.

_________________
Woa, I set up a web server.


Top
 Profile  
 
 Post subject: Re: Upgrade from GTK 2 to GTK 3
PostPosted: Mon Jan 09, 2012 9:23 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Apr 25, 2003 4:57 pm
Posts: 551
Maybe there is a way to determine the default font height and average width in pixels to determine relative sizing and positioning of gadgets in an appropriately sized window?

_________________
Ta - N


Top
 Profile  
 
 Post subject: Re: Upgrade from GTK 2 to GTK 3
PostPosted: Tue Jan 10, 2012 7:46 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jun 06, 2005 2:35 pm
Posts: 594
Location: germany
Quote:
He wants gadgets to scale automatically with the font size.

Yes, this is what I talk about. There are some layout engines like the one delivered with wxwidgets (http://docs.wxwidgets.org/stable/wx_siz ... eroverview). It allows you to create dialogs that resize to the needed size and keep the layout usable even with scaled fonts and other layout styles. It is very handy for people with bad eyes, too...

But you have to drop the idea to set positions pixel-wise. It is more something like "place this button right from that one, but keep it in the window bounds respecting font size and caption".

Kukulkan

_________________
When somebody says "Expect the unexpected" slap them in the face and say" You didn’t expect that, did you?"


Top
 Profile  
 
 Post subject: Re: Upgrade from GTK 2 to GTK 3
PostPosted: Tue Jan 10, 2012 6:29 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Nov 13, 2007 12:42 pm
Posts: 1307
Location: Manchester, UK
I started writing a dynamic cross platform form designer to address this just using pure pb gadgets, but as I switched from Linux back to Windows, development stopped.

Essentially, it was a system where you told it what controls you wanted and in what order, but the background code did all the positioning based on the control sizes. Naturally, window sizing and resizing is automatically handled for you.

This was made possible by virtual "Vertical" and "Horizontal" containers - gadgets added, would be added in vertical or horizontal orientation. For example this bit of xml:
Code:
<Window Name = "Window1" Text = "Dynamic Test!">
  <VBox SizingVertically = "1" SizingHorizontally = "1" Name = "Container_frmShowOff">
    <GBox SizingVertically = "1" SizingHorizontally = "1" Name = "frmShowOff" Text = "Collection Address">
      <VBox SizingVertically = "1" SizingHorizontally = "1" Name = "Items_vbox_frmShowOff">
        <HBox SizingVertically = "0" SizingHorizontally = "1" Name = "Items_hbox1_frmShowOff">
          <Text SizingVertically = "2" SizingHorizontally = "0" Text = "Name :"/>
          <String SizingVertically = "2" SizingHorizontally = "1" Name = "Collection_strName"/>
        </HBox>
        <HBox SizingVertically = "0" SizingHorizontally = "1">
          <Text SizingVertically = "2" SizingHorizontally = "0" Text = "Line 1 :"/>
          <String SizingVertically = "2" SizingHorizontally = "1" Name = "Collection_strLine1"/>
        </HBox>
      </VBox>
      <Spacer SizingVertically = "0" SizingHorizontally = "1" Name = "Spacer1"/>
      <Button SizingVertically = "1" SizingHorizontally = "1" Name = "ButtonMax1" Text = "Click!"/>
    </GBox>
  </VBox>
</Window>


produces this form:
Image

It had three main issues that remaining that I had to address:
Group Boxes - it's a container graphically and yet not a container.
Tables - I haven't a clue on how to write this one, espcially as spanning rows and columns is essential to make it useful.
Code Integration - I haven't decided on the best method of making a "window" for working on later. Should I read the code directly? Stick to xml? What about event wiring?

Is this what you are basically after?


Top
 Profile  
 
 Post subject: Re: Upgrade from GTK 2 to GTK 3
PostPosted: Mon Jan 23, 2012 9:40 pm 
Offline
User
User
User avatar

Joined: Sun Dec 30, 2007 7:24 pm
Posts: 96
That's interesting Foz, rather similar in concept to XAML, XUL or even HTML - I've often thought that a good library leveraging the capabilities of something like Gecko would be an awesome platform for developing UIs (which is pretty much what XUL does of course).

How far did you get with this?


Top
 Profile  
 
 Post subject: Re: Upgrade from GTK 2 to GTK 3
PostPosted: Tue Jan 24, 2012 12:52 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Nov 13, 2007 12:42 pm
Posts: 1307
Location: Manchester, UK
My inspiration came from a little program called "xulpix" which is a mozilla gui designer.

My issue with a separate xml file was that while it could produce decently designed forms, linking events between the xml and the pb code turned into a nightmare.

So I transformed it into straight pb code, with the idea that the designer would "read" the raw pb code and overwrite it - in the same way as other form designers work as well as handle gadget events.

This bit of code was hand written, and I was up to the point of creating a designer to read first, and then write out the code:
Code:
XIncludeFile "purevd.pbi"

; Test template

;{-- purevd start
Declare btnOk_Click()
Declare btnCancel_Click()

Procedure InitialiseGadgets()
  Protected rv.i, WinID.i, tmpID.i
  NewList Contain.i()
 
  ; AddGadget(pName.s, pParentID.i, pGadgetType.i, pText.s, pDesiredWidth.i, pDesiredHeight.i, pFlexWidthType.b, pFlexHeightType.b, pFlags.i = 0, pPath.s = "")
 
  ; add the window
  AddElement(Contain())
  Contain() = AddGadget("winMain", -1, -1, #PB_GadgetType_Window, "Main Window", 600, 400, 0, 0, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered)
  WinID = Contain()
 
  ; All controls to be added here is in a verticle arrangement (vbox)
  tmpID = Contain()
  AddElement(Contain())
  Contain() = AddGadget("Container_frmShowOff", tmpID, WinID, #PB_GadgetType_VBox, "", #PB_Any, #PB_Any, #Sizing_Stretch, #Sizing_Stretch)
 
  ; add a frame
  tmpID = Contain()
  AddElement(Contain())
  Contain() = AddGadget("frmShowOff", tmpID, WinID, #PB_GadgetType_Frame3D, "Showing Off", #PB_Any, #PB_Any, #Sizing_Stretch, #Sizing_Stretch)
 
  ; All controls to be added here is in a verticle arrangement (vbox)
  tmpID = Contain()
  AddElement(Contain())
  Contain() = AddGadget("Items_vbox_frmShowOff", tmpID, WinID, #PB_GadgetType_VBox, "", #PB_Any, #PB_Any, #Sizing_Stretch, #Sizing_Stretch)
 
  ; All controls to be added here is in a horizontal arrangement (hbox)
  tmpID = Contain()
  AddElement(Contain())
  Contain() = AddGadget("Items_hbox1_frmShowOff", tmpID, WinID, #PB_GadgetType_HBox, "", #PB_Any, #PB_Any, #Sizing_Stretch, #Sizing_Stretch)
 
  ; add a text gadget set to minimum size
  AddGadget("txtShowOff1", Contain(), WinID, #PB_GadgetType_Text, "Name", #PB_Any, #PB_Any, #Sizing_MinimumSize, #Sizing_Centre)
  ; add a string gadget set to fill the rest of the frame
  AddGadget("strShowOff1", Contain(), WinID, #PB_GadgetType_String, "<Name goes here>", #PB_Any, #PB_Any, #Sizing_Stretch, #Sizing_Centre)
 
  DeleteElement(Contain()) ; back up to frame
 
  ; add another set of controls in a horizontal arrangement (hbox)
  tmpID = Contain()
  AddElement(Contain())
  Contain() = AddGadget("Items_hbox2_frmShowOff", tmpID, WinID, #PB_GadgetType_HBox, "", #PB_Any, #PB_Any, #Sizing_Stretch, #Sizing_Stretch)
 
  ; add a text gadget set to minimum size
  AddGadget("txtShowOff2", Contain(), WinID, #PB_GadgetType_Text, "E-mail", #PB_Any, #PB_Any, #Sizing_MinimumSize, #Sizing_Centre)
  ; add a string gadget set to fill the rest of the frame
  AddGadget("strShowOff2", Contain(), WinID, #PB_GadgetType_String, "<Password goes here>", #PB_Any, #PB_Any, #Sizing_Stretch, #Sizing_Centre)
 
 
   DeleteElement(Contain()) ; back up to frame vbox
   DeleteElement(Contain()) ; back up to frame
   DeleteElement(Contain()) ; back up to window vbox
 
  AddGadget("spacer1", Contain(), WinID, #PB_GadgetType_Spacer, "", #PB_Any, #PB_Any, #Sizing_Stretch, #Sizing_Stretch)
 
  AddGadget("btnOk", Contain(), WinID, #PB_GadgetType_Button, "OK", 100, 100, #Sizing_Fixed, #Sizing_Fixed)
  AddGadget("btnCancel", Contain(), WinID, #PB_GadgetType_Button, "Cancel", #PB_Any, #PB_Any, #Sizing_Stretch, #Sizing_Stretch)
EndProcedure

Procedure GadgetEventSelection(pWindowEvent, pGadgetEvent, pTypeEvent)
  ForEach gl()
    If pWindowEvent = gl()\WindowID And gl()\ID = pGadgetEvent
      Break
    EndIf
  Next
 
  Select gl()\Name
    Case "btnOk"
      If pTypeEvent = #PB_EventType_LeftClick
        btnOK_Click()
      EndIf
    Case "btnCancel"
      If pTypeEvent = #PB_EventType_LeftClick
        btnCancel_Click()
      EndIf
  EndSelect
 
EndProcedure

Procedure MenuEventSelection(pWindowEvent, pMenuEvent)
  ForEach gl()
    If pWindowEvent = gl()\WindowID And gl()\ID = pMenuEvent
      Break
    EndIf
  Next
 
  Select gl()\Name
  EndSelect
EndProcedure

;}-- purevd end

Procedure btnOk_Click()
  MessageRequester("Main", "Name:" + GetGadgetText(GetGadgetID("winMain", "strShowOff1")) + Chr(13)+Chr(10) + "Email:" + GetGadgetText(GetGadgetID("winMain", "strShowOff2")))
EndProcedure

Procedure btnCancel_Click()
  MessageRequester("Main", "Cancel")
EndProcedure

InitialiseGadgets()
EventLoop()


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye