Icare Posted August 21, 2010 Share Posted August 21, 2010 Hi, For my texture editor (DNA Material) I improved the use of the mouse and keyboard. But I encountered two problems with maxGui: - No detection of the mouse wheel - No EVENT_KEYDOWN if right mouse button is active Does anybody have an idea of why? Nicolas Quote Link to comment Share on other sites More sharing options...
macklebee Posted August 21, 2010 Share Posted August 21, 2010 detection of the mousewheel is EVENT_MOUSEWHEEL, i believe... and couldn't you just perform a check for the keydown event inside the right mouse button's event? Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Icare Posted August 21, 2010 Author Share Posted August 21, 2010 You're thinking thaht I've aldready try EVENT_MOUSEWHELL :-), it's never receive on any gadget ... It's very diffuclt, because that I use Maxgui, KEYDOWN, KEYHIT, MOUSEX etc ... don't work, I must use event. So I can get an event into an event, but it's working fine with right mouse ... My source code for event detection, it's an HookFunction Function GUIHook:Object(iId:Int, tData:Object, tContext:Object) Local Event:TEvent = TEvent(tData) Select Event.id Case EVENT_MOUSEDOWN If Event.Source = cavLeadWerks If Event.data = 1 bControl = True If Event.data = 2 bZoom = True If ActiveGadget() <> frmMain ActivateWindow(frmMain) EndIf Case EVENT_MOUSEUP, EVENT_MOUSELEAVE If Event.Source = cavLeadWerks bControl = False bZoom = False EndIf Case EVENT_MOUSEMOVE If Event.Source = cavLeadWerks AdnMouseX = Event.x AdnMouseY = Event.y sngMouseX = Sgn((AdnMouseX + GadgetX(cavLeadWerks)) - (GadgetWidth(frmMain) / 2)) sngMouseY = Sgn((AdnMouseY + GadgetY(cavLeadWerks)) - (GadgetHeight(frmMain) / 2)) EndIf Case EVENT_KEYDOWN adnKey = Event.data Case EVENT_KEYUP adnKey = 0 adnKeyhit = False Case EVENT_MOUSEWHEEL DebugLog "Mouse wheel" Case EVENT_MENUACTION DoMenuAction(Event.data) Case EVENT_WINDOWCLOSE If Event.source = frmMain CloseADN() EndIf Case EVENT_WINDOWSIZE If Event.source = frmMain SetGraphics CanvasGraphics(cavLeadWerks) End If Case EVENT_GADGETACTION DoGadgetAction(Event.Source, Event.data) Case EVENT_GADGETSELECT If Event.source = treeview Then SetGadgetText(lbsurface, GadgetText(SelectedTreeViewNode(treeview))) loadsurfacemateriel(SelectedTreeViewNode(treeview)) EndIf EndSelect Return tData End Function Quote Link to comment Share on other sites More sharing options...
macklebee Posted August 22, 2010 Share Posted August 22, 2010 Mousewheel events do not appear to work on window gadgets but seem to be working fine for me on any other gadget... as for mixing KEYDOWN events with MOUSE events, you could always toggle a logic point Import maxgui.Drivers Local My_Window:TGadget = CreateWindow("MaxGUITest", 0, 0, 300, 200, Null, WINDOW_TITLEBAR | WINDOW_CENTER) Local My_Canvas:TGadget = CreateCanvas(0, 0, ClientWidth(My_Window), ClientHeight(My_Window), My_Window) ActivateGadget(My_Canvas) Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE Select EventSource() Case My_Window End End Select Case EVENT_MOUSEWHEEL Select EventSource() Case My_Canvas DebugLog "MouseWheel detected: " + EventData() + " Mouse Wheel clicks" End Select Case EVENT_MOUSEDOWN Select EventSource() Case My_Canvas If EventData() = 2 Then rmousedown = 1 End Select Case EVENT_MOUSEUP Select EventSource() Case My_Canvas If EventData() = 2 Then rmousedown = 0 End Select Case EVENT_KEYDOWN Select EventSource() Case My_Canvas If rmousedown = 1 Then DebugLog "The Right mouse button is down and a key has been hit: " + EventData() Else DebugLog "a key has been hit: " + EventData() EndIf End Select End Select Forever Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Icare Posted August 22, 2010 Author Share Posted August 22, 2010 I don't think to active the canvas because EVENT_MOUSEDOWN and UP work fine. After to ActivateGadget() on EVENT_MOUSEMOVE, everything is working... Thank Nicolas Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.