The BAsic CONverter Forum
« Request more parameters for HUG WINDOW function »

Welcome Guest. Please Login or Register.
Jun 19, 2013, 9:37pm




The BAsic CONverter Forum :: General :: Bugs, features :: Request more parameters for HUG WINDOW function
Page 1 of 2 » Jump to page   Go    [Search This Thread] [Share Topic] [Print]
 AuthorTopic: Request more parameters for HUG WINDOW function (Read 918 times)
barryk
Junior Member
**
member is offline





Joined: May 2010
Gender: Male
Posts: 91
Karma: 0
 Request more parameters for HUG WINDOW function
« Thread Started on Mar 31, 2011, 10:10am »

The HUG WINDOW function is somewhat limited, the parameters are just title and x and y coords.

I would like to put in a request that the WINDOW function have more capability.

For example, when a window is created, requests can be sent to the window manager:

no decorations
Without decorations, the titlebar and borders would not display.

position
Request absolute coord, center, mouse-position.

minimized
Request to startup minimized in tray.

I don't know how you would actually implement these in the WINDOW function.

Regards,
Barry Kauler
Link to Post - Back to Top  IP: Logged
Pjot
Administrator
*****
member is offline

[avatar]

[icq]
[homepage]

Joined: Apr 2010
Gender: Male
Posts: 952
Location: The Hague, The Netherlands
Karma: 9
 Re: Request more parameters for HUG WINDOW functio
« Reply #1 on Apr 1, 2011, 4:28pm »

Hi Barry,

Quote:

The HUG WINDOW function is somewhat limited, the parameters are just title and x and y coords.

Yes, you are right. The downside of an abstraction layer is that the resulting API is somewhat limited. Of course one can always use regular GTK functions in addition to the default HUG calls but I can imagine this is a little bit ugly.

Nevertheless there may be an interesting solution: we can add a HUG function like PROPERTY(widget, "name", "value") to set any property of a widget?

Your request below can be set with the following properties:

no decorations
"decorated" property

position
"window-position"

minimized in tray
<not sure if this is possible>

What do you think about this?

Regards
Peter
« Last Edit: Apr 1, 2011, 8:05pm by Pjot »Link to Post - Back to Top  IP: Logged
Pjot
Administrator
*****
member is offline

[avatar]

[icq]
[homepage]

Joined: Apr 2010
Gender: Male
Posts: 952
Location: The Hague, The Netherlands
Karma: 9
 Re: Request more parameters for HUG WINDOW functio
« Reply #2 on Apr 1, 2011, 8:07pm »

With the new HUG 0.40 you can use PROPERTY to set any property of any widget.

Code:
INCLUDE "hug.bac", INIT, WINDOW, BUTTON, ATTACH, CALLBACK, DISPLAY, PROPERTY

GLOBAL flag

SUB Test_Properties

    flag = 1 - flag

    IF flag THEN PROPERTY(win, "decorated", FALSE)
    ELSE PROPERTY(win, "decorated", 1)

END SUB

INIT
win = WINDOW("", 200, 200)

button = BUTTON("Click here", 70, 30)
ATTACH(win, button, 10, 10)
CALLBACK(button, Test_Properties)

' We can set some properties here
PROPERTY(win, "title", "Goodbye")
PROPERTY(win, "tooltip-text", "Testing the properties")

DISPLAY


Regards
Peter
Link to Post - Back to Top  IP: Logged
vovchik
Senior Member
****
member is offline





Joined: Apr 2010
Gender: Male
Posts: 425
Karma: 8
 Re: Request more parameters for HUG WINDOW functio
« Reply #3 on Apr 1, 2011, 10:24pm »

Dear Peter,

What a nice and elegant solution....:)

With kind regards,
vovchik

PS. I will try it out now.
Link to Post - Back to Top  IP: Logged
barryk
Junior Member
**
member is offline





Joined: May 2010
Gender: Male
Posts: 91
Karma: 0
 Re: Request more parameters for HUG WINDOW functio
« Reply #4 on Apr 3, 2011, 1:25pm »

Wow, I was away for a couple of days, and I come back to read this forum and there is a very nice and elegant implementation for window properties.

Yes, a window can be started minimised.

There is also a property that the window can send a hint to the window manager or tray manager not to register in the tray.
I just noticed yesterday that gtkdialog implements that property:

Code:
export DIALOG='
<window title="Example Window" skip_taskbar_hint="true">
<vbox>
<frame Description>
<text>
<label>skip_taskbar_hint=true</label>
</text>
</frame>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
gtkdialog3 --program=DIALOG


...this is very handy if you want a popup window that you don't want to appear in the tray. Sometimes secondary windows that are not the main window would benefit from this.

Anyway, great development, I will download latest HUG and play with it!
Link to Post - Back to Top  IP: Logged
Pjot
Administrator
*****
member is offline

[avatar]

[icq]
[homepage]

Joined: Apr 2010
Gender: Male
Posts: 952
Location: The Hague, The Netherlands
Karma: 9
 Re: Request more parameters for HUG WINDOW functio
« Reply #5 on Apr 6, 2011, 4:29pm »

Thanks Barry!

I also have added the PROPERTY function to the syntax files.

Regards
Peter
Link to Post - Back to Top  IP: Logged
barryk
Junior Member
**
member is offline





Joined: May 2010
Gender: Male
Posts: 91
Karma: 0
 Re: Request more parameters for HUG WINDOW functio
« Reply #6 on Apr 7, 2011, 11:00am »

Peter,
Would you mind also putting the definition for PROPERTY into hug_imports.bac?

I tried to do it myself, but was unsure of correct syntax.

Regards,
Barry
Link to Post - Back to Top  IP: Logged
Pjot
Administrator
*****
member is offline

[avatar]

[icq]
[homepage]

Joined: Apr 2010
Gender: Male
Posts: 952
Location: The Hague, The Netherlands
Karma: 9
 Re: Request more parameters for HUG WINDOW functio
« Reply #7 on Apr 7, 2011, 12:25pm »

Hi Barry,

The IMPORT definition would be this:
Code:
IMPORT "PROPERTY(long,char*,...)" FROM HUG_lib$ TYPE void


However, currently PROPERTY is defined as a macro and cannot be IMPORT'ed from a shared object :)

You may wonder why it is done like that. Thing is that PROPERTY accepts variable types for the property, like a char or long or anything else.

This cannot be wrapped in a regular function as the C 'varargs' API to obtain a variable list of arguments must cast the incoming values using a type. And we don't know the type of the value in advance.

Best regards
Peter

PS I forgot to mention that you do not need to import PROPERTY. It is defined in the INIT function. So as soon as INIT is imported also PROPERTY will be available.
« Last Edit: Apr 7, 2011, 2:17pm by Pjot »Link to Post - Back to Top  IP: Logged
barryk
Junior Member
**
member is offline





Joined: May 2010
Gender: Male
Posts: 91
Karma: 0
 Re: Request more parameters for HUG WINDOW functio
« Reply #8 on Apr 8, 2011, 1:34pm »

The problem I have is this will not compile:

Code:
INCLUDE "hug_imports.bac"
INIT

mainwin = WINDOW("", 425, 285)

PROPERTY(mainwin,"decorated",FALSE)
PROPERTY(mainwin,"title","title here")

DISPLAY


...what do I have to do to make it compile? It can't parse the PROPERTY lines.
Link to Post - Back to Top  IP: Logged
Pjot
Administrator
*****
member is offline

[avatar]

[icq]
[homepage]

Joined: Apr 2010
Gender: Male
Posts: 952
Location: The Hague, The Netherlands
Karma: 9
 Re: Request more parameters for HUG WINDOW functio
« Reply #9 on Apr 8, 2011, 2:37pm »

Hi Barry,

Well you are right and I must apologize - I have mixed up the way you import functions from a Shared Object on the one hand with the selective INCLUDE method on the other hand.

So what I was saying works in case one uses this:
Code:
INCLUDE "hug.bac", INIT, WINDOW, DISPLAY
INIT

mainwin = WINDOW("", 425, 285)

PROPERTY(mainwin,"decorated",FALSE)
PROPERTY(mainwin,"title","title here")

DISPLAY


However, you are importing from HUG as a shared object. Then this doesn't work because the PROPERTY directive is defined as a macro which needs a preprocessor.

I am looking for a solution and will come back to this.

Best regards
Peter
Link to Post - Back to Top  IP: Logged
barryk
Junior Member
**
member is offline





Joined: May 2010
Gender: Male
Posts: 91
Karma: 0
 Re: Request more parameters for HUG WINDOW functio
« Reply #10 on Apr 10, 2011, 12:00pm »

Here is another problem. See this program:

Code:
INCLUDE "hug.bac"
INIT

mainwin = WINDOW("", 425, 285)

PROPERTY(mainwin,"title","title here")
PROPERTY(mainwin,"skip-taskbar-hint",TRUE)
PROPERTY(mainwin,"decorated",FALSE)

DISPLAY


...the strange thing about this program is that the window displays with decorations, however the other two properties do work.

I am puzzled by this, as Vovchik wrote an application named 'psplash' that can set the 'decorated' property to FALSE and psplash does work. I looked at Vovchik's code and can't see anything significantly different.

I am using Puppy Linux Quirky 141 with JWM 500 window manager.
Link to Post - Back to Top  IP: Logged
Pjot
Administrator
*****
member is offline

[avatar]

[icq]
[homepage]

Joined: Apr 2010
Gender: Male
Posts: 952
Location: The Hague, The Netherlands
Karma: 9
 Re: Request more parameters for HUG WINDOW functio
« Reply #11 on Apr 10, 2011, 2:38pm »

Hi Barry,

Strange indeed! On my Ubu 10.10 this program works fine, the window appears without decorations.

Regards
Peter
Link to Post - Back to Top  IP: Logged
Pjot
Administrator
*****
member is offline

[avatar]

[icq]
[homepage]

Joined: Apr 2010
Gender: Male
Posts: 952
Location: The Hague, The Netherlands
Karma: 9
 Re: Request more parameters for HUG WINDOW functio
« Reply #12 on Apr 10, 2011, 5:03pm »

Can you try to compile the following plain C program:
Code:
#include <stdio.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include <stdlib.h>

int main( int argc, char *argv[] )
{
GtkWidget *window;

gtk_init (&argc, &argv);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 425, 285);

g_object_set(window, "title", "title here", NULL);
g_object_set(window, "skip-taskbar-hint", 1, NULL);
g_object_set(window, "decorated", 0, NULL);

gtk_widget_show_all(window);

gtk_main ();
}

Compile as follows:

Quote:

gcc demo.c -o demo `pkg-config --libs --cflags gtk+-2.0`

If you run it and there is still the same problem, then we know it is an issue with your Window Manager (and not BaCon).

Thanks,
Peter
Link to Post - Back to Top  IP: Logged
mave
New Member
*
member is offline





Joined: Apr 2011
Gender: Male
Posts: 5
Karma: 0
 Re: Request more parameters for HUG WINDOW functio
« Reply #13 on Apr 10, 2011, 6:59pm »

Hi Peter, Hi Barry,

this is not your solution, but my "uuups". Tried this code snip in Wary5(q) and got this

Code:
gcc demo.c -o demo `pkg-config --libs --cflags gtk+-2.0`
/usr/X11R7/lib/libxcb-xlib.so.0: undefined reference to `_xcb_unlock_io'
/usr/X11R7/lib/libxcb-xlib.so.0: undefined reference to `_xcb_lock_io'
collect2: ld returned 1 exit status


Had this before while the try to compile seamonkey in Puppy. Is this a C-issue or puppy special?

mave ???
Link to Post - Back to Top  IP: Logged
Pjot
Administrator
*****
member is offline

[avatar]

[icq]
[homepage]

Joined: Apr 2010
Gender: Male
Posts: 952
Location: The Hague, The Netherlands
Karma: 9
 Re: Request more parameters for HUG WINDOW functio
« Reply #14 on Apr 10, 2011, 7:09pm »

@Barry: can you try HUG v0.41 and import the PROPERTY method from HUG as a shared object? I have added its definition also to hug_imports now.

@mave: seems that you are missing some Xlibraries on your system, probably your GTK installation is broken...?

Regards
Peter
Link to Post - Back to Top  IP: Logged
Page 1 of 2 » Jump to page   Go    [Search This Thread] [Share Topic] [Print]

Click Here To Make This Board Ad-Free


This Board Hosted For FREE By ProBoards
Get Your Own Free Message Boards & Free Forums!
Terms of Service | Privacy Policy | Notice | FTC Disclosure | Report Abuse | Mobile