|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
How to show a form with keyboard shortcutHi all,
I'm developing a small app that always stays on the notification area (with trayicon). In this app, I'm trying to show a form with keyboard shortcut, like steps below. 1) Run application. (But don't show a form, Minimized in notification area) 2) Press keyboard shortcut (like Control+Space) 3) Then popup a form But I could't find a way to do it yet. Is it possible to show a form with keyboard shortcut eyen though there is no visible form? I'm using gambas2-2.14.0. Regards, --- Kazutaka HARADA -------------------------------------- Power up the Internet with Yahoo! Toolbar. http://pr.mail.yahoo.co.jp/toolbar/ ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: How to show a form with keyboard shortcut> Hi all,
> > I'm developing a small app that always stays on the notification > area (with trayicon). > > In this app, I'm trying to show a form with keyboard shortcut, > like steps below. > > 1) Run application. (But don't show a form, Minimized in > notification area) > 2) Press keyboard shortcut (like Control+Space) > 3) Then popup a form > > But I could't find a way to do it yet. > > Is it possible to show a form with keyboard shortcut eyen though > there is no visible form? > > I'm using gambas2-2.14.0. > > Regards, > > --- > Kazutaka HARADA > > -------------------------------------- > Power up the Internet with Yahoo! Toolbar. > http://pr.mail.yahoo.co.jp/toolbar/ > You can't if you don't have the focus. What you need is a global shortcut, which is managed by your desktop environment, or a special program. For example, in KDE, there is a control panel entry for configuring them. Regards, -- Benoît ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: How to show a form with keyboard shortcutSorry fo late reply,
> You can't if you don't have the focus. What you need is a global shortcut, > which is managed by your desktop environment, or a special program. > > For example, in KDE, there is a control panel entry for configuring them. > Yes, you are right. But I'm looking for a window manager (or desktop environment) independent way. So I start to write a test program using Xlib with EXTERN declaration like this. ' Gambas module file EXTERN XOpenDisplay(DpyName AS String) AS Pointer IN "libX11" EXTERN XDefaultScreen(Display AS Pointer) AS Integer IN "libX11" EXTERN XDefaultRootWindow(Display AS Pointer) AS Integer IN "libX11" EXTERN XSelectInput(Display AS Pointer, Window AS Integer, KeyMask AS Long) IN "libX11" EXTERN XNextEvent(Display AS Pointer, XEvent AS Pointer) IN "libX11" EXTERN XGrabKey(Display AS Pointer, KeyCode AS Integer, Modifiers AS Integer, Window AS Pointer, OwnEvent AS Boolean, PointerMode AS Integer, KeyboardMode AS Integer) IN "libX11" PUBLIC SUB Main() DIM pDisplay AS Pointer DIM pRootWindow AS Pointer DIM pEvent AS Pointer pDisplay = XOpenDisplay("") pRootWindow = XDefaultRootWindow(pDisplay) XSelectInput(pDisplay, pRootWindow, 1) '1 = KeyPressMask XGrabKey(pDisplay, 95, 0, pRootWindow, FALSE, 1, 1) '95 = F11 key, 1=GrabModeAsync DO XNextEvent(pDisplay, pEvent) PRINT ("Key F11 Pressed") LOOP END When F11 Key, keycode is 95 on my japanese keyboard, is pressed, It should print the message. But actually program exit with signal 11. Any comments or suggestions are wlecome. Regards, -- -------------------------------------- Kazutaka HARADA e-mail:kazutaka802@... -------------------------------------- ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: How to show a form with keyboard shortcutHARADA Kazutaka ha scritto:
> Sorry fo late reply, > > >> You can't if you don't have the focus. What you need is a global shortcut, >> which is managed by your desktop environment, or a special program. >> >> For example, in KDE, there is a control panel entry for configuring them. >> >> > > Yes, you are right. > But I'm looking for a window manager (or desktop environment) > independent way. > > So I start to write a test program using Xlib with EXTERN declaration > like this. > > ' Gambas module file > EXTERN XOpenDisplay(DpyName AS String) AS Pointer IN "libX11" > EXTERN XDefaultScreen(Display AS Pointer) AS Integer IN "libX11" > EXTERN XDefaultRootWindow(Display AS Pointer) AS Integer IN "libX11" > EXTERN XSelectInput(Display AS Pointer, Window AS Integer, KeyMask AS > Long) IN "libX11" > EXTERN XNextEvent(Display AS Pointer, XEvent AS Pointer) IN "libX11" > EXTERN XGrabKey(Display AS Pointer, KeyCode AS Integer, Modifiers AS > Integer, Window AS Pointer, OwnEvent AS Boolean, PointerMode AS Integer, > KeyboardMode AS Integer) IN "libX11" > > PUBLIC SUB Main() > > DIM pDisplay AS Pointer > DIM pRootWindow AS Pointer > DIM pEvent AS Pointer > > pDisplay = XOpenDisplay("") > pRootWindow = XDefaultRootWindow(pDisplay) > XSelectInput(pDisplay, pRootWindow, 1) '1 = KeyPressMask > XGrabKey(pDisplay, 95, 0, pRootWindow, FALSE, 1, 1) '95 = F11 key, > 1=GrabModeAsync > DO > XNextEvent(pDisplay, pEvent) > PRINT ("Key F11 Pressed") > LOOP > END > > When F11 Key, keycode is 95 on my japanese keyboard, is pressed, > It should print the message. But actually program exit with signal 11. > > Any comments or suggestions are wlecome. > I think that in the call to XNextEvent you are passing a NIL pointer; libX11 tries to put data in the area pointed by pEvent. You should allocate some memory in it, enough to hold the event data. If, on the other hand (I don't have the docs at hands right now), X11 should allocate the event, and return to you the pointer to the event, then again you should pass to X11 a pointer to a pointer... but you pass it a NULL. Anyway, my compliments for the low-level management. This is not seen every day :-) Regards, Doriano ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: How to show a form with keyboard shortcutDoriano Blengino wrote:
> I think that in the call to XNextEvent you are passing a NIL pointer; > libX11 tries to put data in the area pointed by pEvent. You should > allocate some memory in it, enough to hold the event data. If, on the > Hi, Doriano Thanks for your comment. As you suggested above, I added following line to allocate the memrory, then program runs normally. No signall 11 error. pEvent = Alloc(15) ' 15 is temporary size Now I can go to the next step! Regards, -- -------------------------------------- Kazutaka HARADA e-mail:kazutaka802@... -------------------------------------- ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
| Free embeddable forum powered by Nabble | Forum Help |