Changes from Version 1 of documentation/FAQ

Show
Ignore:
Author:
peterc (IP: 192.168.0.1)
Timestamp:
12/20/07 10:42:28 (10 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • documentation/FAQ

    v0 v1  
     1= Frequently Asked Questions = 
     2[[PageOutline]] 
     3 
     4== How do I enable dragging? == 
     5 
     6You need to set the ''drag'' property of your element to one of ''drag'' or ''drag-drop''. See [wiki:documentation/RCSS/UserInterface#Dragdrop:thedragproperty Dragging] for full details. 
     7 
     8Note that the element will not be automatically dragged around by the mouse. It will send the ''dragstart'', ''dragend'', ''dragmove'', ''dragover'', ''dragout'' and ''dragdrop'' events, which your application can listen for to move and animate the element as appropriate. 
     9 
     10== How do I bind to events from C++/script? == 
     11 
     12Use the ''AddEventListener'' function, passing in the name of the event you want to bind to (without the "on" prefix), the function to call and whether you want to bind in the capture phase or not. 
     13 
     14From C++: 
     15{{{ 
     16class MyListener : public Rocket::Core::EventListener 
     17{ 
     18public: 
     19        void ProcessEvent(Rocket::Core::Event& event) 
     20        { 
     21                printf("Processing event %s", event.GetType().CString()); 
     22        } 
     23} 
     24}}} 
     25 
     26{{{ 
     27   my_listener = new MyListener(); 
     28   element = document->GetElementById("element5"); 
     29   element->AddEventListener("click", my_listener, false); 
     30}}} 
     31 
     32From Python: 
     33{{{ 
     34        element = document.GetElementById('element5') 
     35        element.AddEventListener('click', 'MyFunction(self, document)', False) 
     36}}} 
     37 
     38== Can I change decorators from script? == 
     39 
     40Not directly, however you can change the element's class which can affect which decorators are applied to it. 
     41 
     42== How do I set up custom cursors? == 
     43 
     44You can load documents as cursor objects into your context with the ''LoadMouseCursor'' function. The first cursor to be loaded into a context is the default cursor; if an element does not specify a cursor override, then that is the cursor that will be visible. To override the default cursor, set the ''cursor'' property of your element. See [wiki:documentation/RCSS/UserInterface#Cursors:thecursorproperty Cursors] for full details.