Deleted
Deleted Member
Posts: 0
|
Post by Deleted on May 24, 2012 21:44:21 GMT 1
This would have been much easier and quicker with a gui rad. I agree it would be easier and quicker. I don't agree it would be much easier and quicker. As I said HUG is very easy to understand and use. I had a look on your program and I think windows could be done within one day. How many percent of total time you spent on the whole project is that? If you decide to write a GUI designer you will spend a lot of time on it. Time that could be used for designing many (> 100?) interfaces for other programs. So, what's the point in it? It's just my opinion.
|
|
|
Post by fragadelic on May 24, 2012 22:13:13 GMT 1
I have a job and a family. I don't have unlimited time to work on these things. Getting all the alignment just right and testing everything was very time consuming as I had to recompile after each small change to see if it was enough. You will notice that it is not just straight hug imported. libvte is also imported and I tweaked the alignments so text lines up properly.
Creating the gui is a very small portion of what needs to be done for a complete app anyway. I have over 5 years into my project with a lot of testing of all the backend tools.
I usually only get 10 minutes here and 10 minutes there to work on these things so it took me quite a while to get it all looking and working like I wanted. I also spend a lot of time supporting my project on my forum and answering emails. I am the only one working on it too so the spare time I have gets divided into the many different tasks needed to run a project.
I have to create a new installer for the debian version of remastersys and was considering doing it in bacon/hug but it will take quite a while. I might end up doing it in pygtk/glade anyway even though I'm not proficient in glade or python but it will take me less time to create and test than manually with bacon/hug.
Again, this thread was about those interested in doing it. If you are not interested in doing it then why bother even replying in the thread?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on May 24, 2012 22:41:14 GMT 1
If you are not interested in doing it then why bother even replying in the thread? Sorry, I thought you also wanted to know potential users and/or other BaCon users opinion (collaborating means many things). This is not your private forum, so if you want to talk about something you plan to do for yourself only, you should be clear about it. Otherwise, people will think that you're asking about the project generally (what other users think about the idea, who's interested, how many people would like to have it etc). And yes, if you decide to do it, I'm interested, but all I can do is to help with testing and to give suggestions (I also have a family and a job). But now I'm not sure if this is what you mean by "collaborating".
|
|
|
Post by fragadelic on May 25, 2012 0:06:02 GMT 1
Collaborating on a rad is about working to create one. It is quite plain and simple. I know this isn't my forum but usually forums work in such a way that if there is a specific topic in the subject then it is generally understood that you stick to that topic or start a new thread with your own agenda.
I see many folks here saying "Why bother or you can do this or that?" Well why have another basic programming language for linux?
The simple answer - why not?
If gambas was slimmer in deps I would have stuck with it instead. I like basic as it was my first programming language that I learned 31 years ago and its nice to be able to use it again.
You see, this is the Code Projects are of the forum. Building a rad with bacon/gtk/hug is a Code Project.
I guess I will sit back and see where this goes but not having a rad prevents me from using bacon more seriously on more of my projects.
I don't see how you can say it wouldn't be faster - a RAD is for Rapid Application Development. The whole purpose of it is to speed things up. What you are saying is kind of like saying why use a gui at all when you can just as quickly type everything in.
Anyway, I'm done explaining this thread. Take it or leave it. I would like to work on this but if nobody else wants to then I won't bother.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on May 25, 2012 2:07:26 GMT 1
Then you should have started this topic like that (just an example): I wouldn't reply to the post like that and I'm pretty sure many other users wouldn't too. What you wrote wasn't specific and looked more like an invitation to a general discussion about a RAD. People were trying to be nice and explain why they are not interested, why they think it's not the best idea or what in their opinion is a better option (including Peter). That was perfectly on topic and I really can't understand why you are getting so upset (OK, I can understand IUP ). I don't want to fight with anyone. If you decide to do this project, good luck! Regards!
|
|
|
Post by oldguy on May 25, 2012 2:51:53 GMT 1
Why is it that instead of encouraging ones ambitions people try to talk them out of it? If one wants to give it a crack, encourage them and see where they take it. Don't kill the buzz just because you can't see it materializing...
Fragadelic, you want a RAD, then dig in and give it a try. Worst case, you'll learn something.
|
|
|
Post by fragadelic on May 25, 2012 3:23:26 GMT 1
Tomaaz - check my first post in this thread. The last line.
I'm pretty sure that is as clear as it can be.
oldguy - I don't have the time to work on this myself. A task like this is too much for a single person especially if it is to be a serious effort and efficient.
|
|
2lss
Full Member
Posts: 140
|
Post by 2lss on May 25, 2012 4:27:45 GMT 1
If anyone is interested, I threw together a demo program for placing widgets. Its not the greatest, and probably could use some optimizations. You need 'libgtkgl2.0-1' or else hug will default to gtk canvas and the movement will be very choppy.
INCLUDE hug.bac
SUB HandleMouse cursor_x = MOUSE(0) cursor_y = MOUSE(1) IF MOUSE(2) = 1 AND ISTRUE(widget_clicked(cursor_x, cursor_y)) THEN offset_x = square_x-cursor_x offset_y = square_y-cursor_y DRAW(canvas) REPEAT SQUARE("#FFFFFF", 0, 0, canvas_x, canvas_y, TRUE) SQUARE("#FF0000", square_x, square_y, 50, 50, 1) SYNC IF MOUSE(0) > 0 THEN square_x = MOUSE(0) + offset_x IF MOUSE(1) > 0 THEN square_y = MOUSE(1) + offset_y UNTIL MOUSE(2) = 3 END IF END SUB
FUNCTION widget_clicked(NUMBER x, NUMBER y) IF x > square_x AND x < (square_x + square_side) AND \ y > square_y AND y < (square_y + square_side) THEN RETURN TRUE ELSE RETURN FALSE END IF END FUNCTION
canvas_x = 450 canvas_y = 450
square_x = 200 square_y = 200
square_center = 25 square_side = square_center*2
INIT
HUGOPTIONS("CANVAS GL") HUGOPTIONS("GL_FREEZE 1")
newwin = WINDOW("Canvas Test", 400, 440) canvas = CANVAS(canvas_x, canvas_y) ATTACH(newwin, canvas, 0, 0)
mark1 = MARK("Left Click to Move Widget, Right Click to Stop", 300, 15) ATTACH (newwin, mark1, 42, 418)
SYNC SQUARE("#FF0000", square_x, square_y, square_side, square_side, 1) SYNC
CALLBACK(canvas, HandleMouse)
DISPLAY
|
|
|
Post by bigbass on May 25, 2012 7:47:23 GMT 1
Hey 2lss great stuff for a demo ! I didn't have a canvas widget demo and this is perfect Get x and y positions for GUI building I added the x and y positions on the canvas and terminal thanks Joe
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on May 25, 2012 9:11:22 GMT 1
fragadelic, once again - if you are not interested in other users opinion then move this topic to PM. Replies posted by people are as specific as your question. Some users are interested, some are not and they are explaining why (including Peter). Apart from IUP, everything stays perfectly on topic and I'm starting to think that you are arguing with me only because I'm new here. So if you're telling me to shut up, please tell the same Peter, cause it's not that much difference between my and his opinion. Thanx.
oldguy, no one is trying to talk anyone out of the project, but it would be nice to know what kind of project it is. Is it a challenge that supposed to be fun? Or is it a serious project? If the author of this topic thinks that a GUI designer is something anyone here is waiting for, he's wrong (and BASIC forums are full of disappointed and frustrated developers that thought something was wanted and would be used by many people). Other people trying to make it clear to him. They are also trying to make it clear how complicated the task it is and suggest easier ways. So, what's wrong with it? Even if fragadelic decides to do it his way, those are still useful informations.
|
|
|
Post by Pjot on May 25, 2012 10:37:40 GMT 1
Folks, Please stop arguing, and let's see how to contribute, if possible. Or suggest solutions or alternatives... For this project (if it will turn into one), I can promise to solve bugs or issues as usual. Or add features if that is convenient. Best regards, Peter
|
|
|
Post by bigbass on May 26, 2012 7:28:45 GMT 1
Hey guys if you want to keep it simple without GTK function coding it could be done as a visual aid pretty easy just using what we already have BaCon and HUG at least its an idea in motion I'm for keeping things easy if you need a complex thingy that will take months planning and coding have fun and build something cool I'll be playing with this thanks 2lss this is fun faster than recompiling to see the end result and no danger to your real code this could output the x and y values to a file and take input to change the canvas size generate standard button images and other widgets easily since they are images sort of a scratch pad for ideas that gives you instant placement values only and with a special label for each image we could pre fill in some code using a simple template for the basic widget this will be easy to get something working fast *removed all the looping so no flashing problems now Joe place this icon in /usr/share/pixmaps INCLUDE hug.bac
canvas_x = 400 canvas_y = 380
'---------------------- SUB CLEAN_SCREEN() '---------------------- 'clear terminal output CLEAR 'redraw canvas again canvas = CANVAS(canvas_x, canvas_y) ATTACH(win, canvas, 0, 0) CALLBACK(clean, CLEAN_SCREEN) CALLBACK(canvas, HandleMouse) CALLBACK(myquit, QUIT) END SUB
'---------------------- SUB HandleMouse() '---------------------- cursor_x = MOUSE(0) cursor_y = MOUSE(1) IF MOUSE(2) = 1 THEN PRINT PRINT cursor_x, " cursor_x" PRINT cursor_y, " cursor_y" PRINT DRAW(canvas) SYNC txt$ = CONCAT$(STR$(cursor_x),"x", NL$, STR$(cursor_y), "y") OUT(txt$ , "blue", "white", 0, 350) SYNC LINE("blue", 0, cursor_y, 400, cursor_y) LINE("red", cursor_x, 0, cursor_x, 325) LINE("black", 0, 325, 400, 325) LINE("black", 0, 326, 400, 326) LINE("black", 0, 327, 400, 327) LINE("black", 0, 328, 400, 328) PICTURE("/usr/share/pixmaps/close.png", cursor_x, cursor_y, 84, 26) END IF END SUB
'---------------------- 'MAIN GUI '---------------------- INIT HUGOPTIONS("CANVAS GL") HUGOPTIONS("GL_FREEZE 1")
win = WINDOW("Get x and y positions", 400, 440) canvas = CANVAS(canvas_x, canvas_y) ATTACH(win, canvas, 0, 0)
mark1 = MARK("Left click to start", 300, 15) ATTACH (win, mark1, 42, 418)
clean = BUTTON("Clean", 70, 30) myquit = BUTTON("Quit", 70, 30) ATTACH(win, clean, 10, 400) ATTACH(win, myquit, 318, 400) CALLBACK(clean, CLEAN_SCREEN) CALLBACK(canvas, HandleMouse) CALLBACK(myquit, QUIT) DISPLAY
|
|
mobeus
Junior Member
Posts: 86
|
Post by mobeus on May 26, 2012 22:20:27 GMT 1
Hi everyone,
I’m asking everyone to please test this code and report back, good or bad.
It employs a work-around to access an element of an opaque gtk struct (GtkWidget) that works on my 32 bit system and we need to know if it is valid on 64 bit systems. One other thing I question is if the default LOCAL data type of widget_window should be an unsigned integer to avoid address problems.
Almost forgot to mention, this code creates a window with a button that can be dragged with the mouse. There isn’t any bounds checking so be careful not to drag it off the top or left side, you can lose it.
Thanks for any feedback. Mobeus
IMPORT "gtk_init(int*,void*)" FROM "libgtk-x11-2.0.so" TYPE void IMPORT "g_signal_connect_data(long,char*,long,long,long,int)" FROM "libgobject-2.0.so" TYPE void IMPORT "gtk_window_new(int)" FROM "libgtk-x11-2.0.so" TYPE long IMPORT "gtk_button_new_with_label(char*)" FROM "libgtk-x11-2.0.so" TYPE long IMPORT "gtk_fixed_new" FROM "libgtk-x11-2.0.so" TYPE long IMPORT "gtk_container_add(long,long)" FROM "libgtk-x11-2.0.so" TYPE void IMPORT "gtk_fixed_put(long,long,int,int)" FROM "libgtk-x11-2.0.so" TYPE void IMPORT "gtk_fixed_move(long,long,int,int)" FROM "libgtk-x11-2.0.so" TYPE void IMPORT "gtk_container_set_border_width(long,int)" FROM "libgtk-x11-2.0.so" TYPE void IMPORT "gtk_widget_set_events(long,int)" FROM "libgtk-x11-2.0.so" TYPE void IMPORT "gtk_widget_show_all(long)" FROM "libgtk-x11-2.0.so" TYPE void IMPORT "gtk_main" FROM "libgtk-x11-2.0.so" TYPE void IMPORT "gtk_main_quit" FROM "libgtk-x11-2.0.so" TYPE void IMPORT "gdk_window_at_pointer(long,long)" FROM "libgdk-x11-2.0.so" TYPE long IMPORT "gdk_window_get_pointer(long,long,long,long)" FROM "libgdk-x11-2.0.so" TYPE long
CONST GDK_BUTTON1_MASK = 1 << 8 CONST GDK_EXPOSURE_MASK = 1 << 1 CONST GDK_POINTER_MOTION_MASK = 1 << 2 CONST GDK_POINTER_MOTION_HINT_MASK = 1 << 3 CONST GDK_BUTTON_PRESS_MASK = 1 << 8 CONST GDK_LEAVE_NOTIFY_MASK = 1 << 13 CONST EVENTS_MASK = GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_LEAVE_NOTIFY_MASK CONST BOREDR_WIDTH = 5
SUB prog_end gtk_main_quit() END END SUB
SUB set_drag_events(NUMBER widget) gtk_widget_set_events(widget, EVENTS_MASK) END SUB
FUNCTION button_press_event(NUMBER widget, NUMBER event) USEC typedef struct { int type; void *window; signed char send_event; unsigned int time; double x; double y; double *axes; unsigned int state; unsigned int button; } GdkEventButton;
GdkEventButton *mousebutton; mousebutton = (GdkEventButton*)event;
sx=(int)mousebutton->x; sy=(int)mousebutton->y;
END USEC
RETURN TRUE END FUNCTION
FUNCTION motion_notify_event( NUMBER widget, NUMBER event) LOCAL x, y, state
gdk_window_get_pointer(widget_window, ADDRESS(x), ADDRESS(y), ADDRESS(state));
IF (state EQ GDK_BUTTON1_MASK) THEN gtk_fixed_move( fixed, widget, x-sx, y-sy ) END IF
RETURN TRUE END FUNCTION
sx = 0 sy = 0
gtk_init(0, 0)
window = gtk_window_new(0)
'WORK AROUND: Address of GtkWidget->window element obtained from window variable? widget_window = window + 176
gtk_container_set_border_width(window, BOREDR_WIDTH) button = gtk_button_new_with_label("Drag Me Around") fixed=gtk_fixed_new() gtk_container_add(window, fixed) gtk_fixed_put(fixed, button, 100,100 ) g_signal_connect_data(window, "destroy", ADDRESS(prog_end), 0, 0, 0) g_signal_connect_data(button, "button_press_event", ADDRESS(button_press_event), 0, 0, 0) g_signal_connect_data(button, "motion_notify_event", ADDRESS(motion_notify_event), 0, 0, 0) set_drag_events(window) set_drag_events(button) gtk_widget_show_all(window) gtk_main()
|
|
|
Post by bigbass on May 27, 2012 6:14:48 GMT 1
Hey mobeus
Your code worked on my box maybe we can get some new functions with your testing of GTK
*I updated my code above it is very easy using 100% HUG it's my first time using the canvas
EDIT
Please note that using GTK is a valid and a great development step to get a working idea to light quickly
this code method bridges the GTK to BaCon missing step which we need very much a whole new thread could be dedicated to this method just to to shed light on the method of using "raw" GTK in BaCon
but then the next step is to finally get it into HUG so we can all have easy HUG syntax for the following projects to use these new widgets
Joe
|
|
2lss
Full Member
Posts: 140
|
Post by 2lss on May 27, 2012 18:28:37 GMT 1
Hey bigbass, I gave your latest program a try and it works great. Only one problem, I have to use gtk canvas instead of GL for the PICTURE function to work. I'm guessing that this is a bug in hug. The code posted by mobeus looks like an efficient way to drag the widgets around, however I can't get it to work on my system. When the cursor is placed over the window I get a long string of errors: Gdk-CRITICAL **: IA__gdk_window_get_pointer: assertion `window == NULL || GDK_IS_WINDOW (window)' failed And I can't drag the button... I'm thinking there is a problem with the function 'gdk_window_get_pointer' since the variable 'state' is always 0. I'll try to get it working, but I'm pretty bad at the gtk/gdk stuff
|
|