Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Feature request
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 11-27-2007, 11:34 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Global mouse checks

I've encountered this problem multiple times while working with GUI's in Graal. There is no 'universal' check for mouseclicks. onMouseUp, for example, only fires when the mouse is released inside GraalControl. The main problem arises when dealing with the drag function for GUI's. Ideally, if you start a drag inside a GUI, you don't want the functionality of it to stop working just because you leave the GUI... it makes it tedious to work. If I start dragging my mouse and leave the GUI, it messes the script up, and I've yet to find a way to work around this.

Either way, functions like onMouseUp and onMouseDown should be relevant to the GUIContainer, not GraalControl.
Reply With Quote
  #2  
Old 11-28-2007, 10:03 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
There are different ways to detect that.

1. Use the built-in dragndrop system: MyControl.canmove = true; MyControl.clipmove = false, and then write code into "function MyControl.StopDrag"

2. When you start clicking in a control and then move the mouse outside then normally the previous control is getting the onMouseUp

3. Force that the GraalControl has the focus with GraalControl.makefirstresponder(true) and then just update the position of your dragndrop control to match the mouse position until the mouse has been released. It is easy to detect if the mouse is still down while the graalcontrol has the focus (variable mousebuttons).

4. Write a function onFirstResponderChanges(obj) to keep track of the currently selected GUI control.

5. Use mousebuttonsglobal
Reply With Quote
  #3  
Old 12-04-2007, 08:22 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
A simple drag'n'drop script:

PHP Code:
function MyControl.onMouseDragged(modifierkeys,mx,my) {
  if (
isObject("DragControl"))
    return;

  new 
GuiBitmapCtrl("DragControl") {
    
width height 32;
    
mx width/2;
    
my height/2;
    
bitmap "graalicon_big.png";
    
alpha 0.5;
  }
  
DragControl.startDrag();
}

function 
DragControl.onStopDrag() {
  
DragControl.destroy();

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:11 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.