GUI applications

For other topics related to the FreeBASIC project or its community.
TJF
Posts: 3473
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Sep 18, 2011 7:18

agamemnus wrote:We should just steal the website code from the German website. :P

I like to see Sebastians face when he is surfing to his website and finds out that you have stolen all the code ;-) Maybe we also can link to the site and add some english description? And lots of new examples ...


agamemnus wrote:Maybe I will try helping with tutorials on setting up GTK and GladeToBac.. can you give me some links (forum links here, etc.) to get me started?

Give it a try, that would be great! The best point to start is the GladeToBac_ReadMe.txt file that can be downloaded here. It also contains my personal Email (feel free to use it if you need any help).
TJF
Posts: 3473
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: I have got some GTK tutorials in PDF last night.

Postby TJF » Sep 18, 2011 7:53

vladimir777 wrote:I have got some GTK tutorials in PDF last night.

LINK IS HERE:

http://www.moreplovac.com/GTKBOOKS.zip 17MB


This one is GOOD:

GTK_drawing.pdf

GTK_drawing.pdf is well explained, but it's outdated. I'm searching for a similar tutorial which explains instead of gdk drawing primitives the new cairo features.

Anyway, thanks for sharing!
chung
Posts: 593
Joined: Jan 16, 2010 20:52
Location: France
Contact:

Postby chung » Sep 18, 2011 8:43

do you know Liberty Basic ? a slow but easy language to make multiwindows gui programs (shareware)

i have written a "Liberty Basic" like opensource coding library named gui_chung (18k .bi file + jpeg.dll ) with openGL support. I have yet programmed some 3D games with it.

it uses standard windows api, so i wonder if it may work on linux with "wine" , a software for running windows applications on linux ?

you can find it there => http://www.freebasic.net/forum/viewtopic.php?t=16576

or here => http://chungswebsite.blogspot.com/search/label/gui

sample program :

Code: Select all

#Include Once "windows.bi"
#Include Once "gui_chung.bi"


Sub notice(ByRef msg As string,ByRef title As String ="notice")
   messagebox(0,msg,title,0)
End Sub

dim shared as integer quit=0
Sub mysubquit
        notice("trapclose")
   quit=1
End Sub
Sub subhello
   notice("hello !")
End Sub

' Program start
button("win.button1","click here",@subhello,10,10,100,40)
openwindow("win","my window",100,100,500,300)

trapclose("win",@mysubquit)

While quit=0 And Not guitestKey(vk_escape)
   guiscan  'scan for input and continue
   'guiwait  'wait for msg
   Sleep 40
Wend
guiclose 'close all
guiquit  'free all & quit
'notice("end")
End
TJF
Posts: 3473
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Sep 18, 2011 9:28

chung wrote:i have written a "Liberty Basic" like opensource coding library named gui_chung (100k .bi file + jpeg.dll ) with openGL support. I have yet programmed some 3D games with it.

it uses standard windows api, so i wonder if it may work on linux with "wine" , a software for running windows applications on linux ?

Thanks for your statement and the effort you spent on this project. Your library is game specific.

In the first post
mee wrote:If so, how does one develop business applications with input fields, click boxes and so forth?
I'm also speaking about further widgets needed in business appilcations like sorted ListViews, ColorChoosers, FontChoosers, FileChoosers, TreeViews, IconViews, DnD, Clipboard support, TextEdits, printing, ... And I'm speaking about real cross-platform code (without wine emulation).
vladimir777
Posts: 94
Joined: Aug 19, 2011 18:28

FORCE REFRES PROGRESS BAR ???

Postby vladimir777 » Sep 18, 2011 18:10

Code: Select all


#LIBPATH "C:\opt\GTK-3.0.9\lib"

#include once "TJF/gtk.bi"

#define NULL 0
SUB TEST1 CDECL (BYVAL widget AS GtkWidget PTR, BYVAL pr1 AS GtkWidget PTR)
print "Test 2 - doesnot work well"
dim dd as double
gtk_widget_set_sensitive(widget, FALSE)

for dd = 0 to 1 step 0.1
   gtk_progress_bar_set_text (GTK_PROGRESS_BAR(pr1), str(dd))
   gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(pr1), dd)
   
   gtk_widget_queue_draw (GTK_WIDGET (pr1)) 
   gtk_widget_map (GTK_WIDGET (pr1)) 
   gtk_widget_show_now (GTK_WIDGET (pr1))
   ' how do I force refreshing progress bar here
   
   print dd
   sleep 300
next dd


gtk_widget_set_sensitive(widget, TRUE)
end sub

SUB TEST2 CDECL (BYVAL widget AS GtkWidget PTR, BYVAL pr1 AS GtkWidget PTR)
print "This is OK"
dim dd as double
dd = rnd * 1
   gtk_progress_bar_set_text (GTK_PROGRESS_BAR(pr1), str(dd))
   gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(pr1), dd)
end sub

gtk_init(@__FB_ARGC__, @__FB_ARGV__)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim As GtkWidget Ptr win = gtk_window_new(GTK_WINDOW_TOPLEVEL)
   gtk_window_set_title(GTK_WINDOW(win), "PROGRESS BAR DEMO")
   gtk_widget_set_size_request(win, 400, 250)
   gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER)
Dim As GtkWidget Ptr fixed = gtk_fixed_new()
   gtk_container_add(GTK_CONTAINER(win), fixed)
Dim As GtkWidget Ptr button1 = gtk_button_new_with_label("Random")
   gtk_widget_set_size_request(button1, 80, 35)
   gtk_fixed_put(GTK_FIXED(fixed), button1, 50, 90)
Dim As GtkWidget Ptr button2 = gtk_button_new_with_label("GO")
   gtk_widget_set_size_request(button2, 80, 35)
   gtk_fixed_put(GTK_FIXED(fixed), button2, 150, 90)   
Dim As GtkWidget Ptr p1 = gtk_progress_bar_new ()
   gtk_widget_set_size_request(p1, 380, 35)
   gtk_fixed_put(GTK_FIXED(fixed), p1, 10, 10)   
   
   gtk_progress_bar_set_text (GTK_PROGRESS_BAR(p1), "bbbbbb")
   gtk_progress_bar_set_show_text(GTK_PROGRESS_BAR(p1), TRUE)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK (@gtk_main_quit), NULL)
g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK (@Test1), p1)
g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK (@Test2), p1)
g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK (@gtk_main_quit), NULL)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''     
gtk_widget_show_all(win)
gtk_main()
END 0



TJF
Posts: 3473
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Sep 18, 2011 18:35

Try

Code: Select all

SUB TEST1 CDECL (BYVAL widget AS GtkWidget PTR, BYVAL pr1 AS GtkWidget PTR)
  PRINT "Test - works pretty well"
  DIM dd AS DOUBLE
  gtk_widget_set_sensitive(widget, FALSE)
 
  FOR dd = 0 TO 1 STEP 0.1
    gtk_progress_bar_set_text (GTK_PROGRESS_BAR(pr1), STR(dd))
    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(pr1), dd)

    ' how do I force refreshing progress bar here
    WHILE(gtk_events_pending()) : gtk_main_iteration() : WEND

    PRINT dd
    SLEEP 300
  NEXT dd

  gtk_widget_set_sensitive(widget, TRUE)
END SUB
vladimir777
Posts: 94
Joined: Aug 19, 2011 18:28

Postby vladimir777 » Sep 18, 2011 20:42

Thx

TJF, have you seen


http://live.gnome.org/GooCanvas

http://developer.gnome.org/goocanvas/unstable/

GooCanvas is a canvas widget for GTK+ that uses the cairo 2D library for drawing.
TJF
Posts: 3473
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Sep 19, 2011 8:37

vladimir777 wrote:TJF, have you seen


http://live.gnome.org/GooCanvas

Not yet. Thanks for the link, I'll check it.
TJF
Posts: 3473
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Sep 21, 2011 13:21

vladimir777 wrote:TJF, have you seen


http://live.gnome.org/GooCanvas

It's usefull. I made a header and some examples. Have a look at GooCanvas: header for advanced GTK drawing widget.
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Postby agamemnus » Sep 22, 2011 22:10

TJF: just downloading that thing was work. I need about a month's recuperation and then I'll try to use it... :|
TJF
Posts: 3473
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Sep 23, 2011 5:22

agamemnus wrote:TJF: just downloading that thing was work. I need about a month's recuperation and then I'll try to use it... :|

Imagine the work developing this code!

What are you talking about? GladeToBac or GooCanvas?
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Postby agamemnus » Sep 23, 2011 7:12

GladeToBac, I think.
TJF
Posts: 3473
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Sep 23, 2011 7:29

agamemnus wrote:GladeToBac, I think.

I made a little example. You may use it to test your installation and get started:

FB_Calc, an example for a small GTK application
Daniel_
Posts: 2
Joined: May 14, 2011 22:03

Postby Daniel_ » Sep 23, 2011 15:51

Neither GTK or winapi are for beginners...

Perharps i'm taking the name lliteraly. But the idea behind a basic language isn't that of been friendly to beginners ?

Well, maybe it isn't...

after all, one of the ideas for the logo on the website was: Think C without braces...

I don't really thing we need another C... and freebasic really isn't a champion in popularity

A easy to use native gui toolkit as part of the language library would be a nice addition that could perhaps make FB more popular...
TJF
Posts: 3473
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Sep 23, 2011 17:12

Daniel_ wrote:A easy to use native gui toolkit as part of the language library would be a nice addition that could perhaps make FB more popular...

I do not target this kind of popularity. This will make FB a naive tool, VB died that way. If you're looking for such a GUI toolkit, use one of the existing or write your own.

For people who need GUI features for business apps (Clipboard, DnD, Printing, Network, L10N, I18N, ...) this is not enough. One of the main reasons this comunity grows day by day is that everybody (who is able to learn it) can use unnativ and powerfull libraries and extern tools.

Return to “Community Discussion”

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest