Today we are going to solve some of the problems in the last drag-and-drop prototype. What are the questions below?Attach the JavaScript code of the previous period to make it easier for you to see the problem.script type="Text/javascript">Window.onload = function() { varOdiv = document.getElementById ("Div1");varDISX =0;varDisy =0; Odiv.onmousedown = function(EV) { varoevent = EV | |
:
A. Rewrite listview here to generate Swipemenulistview, so he is still a ListView list control;
B. Since the need for left-slip, it must be in the Ontouchevent () method to determine the operation of gesture sliding;
C. The need to take into account the conflict of the dropdown, pull and left-slip events;
D. The need to consider a left-sliding delete event can only have one item in the deletion state at a time;
@Override public boolean ontouchevent (motionevent
Now, let's move it to the body. We will introduce several function functions before getting started!1. functions used to format eventsCopy codeThe Code is as follows:Function getEvent (){// Compatible with both ie and ffIf (document. all) return window. event;Func = getEvent. caller;While (func! = Null ){Var arg0 = func. arguments [0];If (arg0 ){If (arg0.constructor = Event | arg0.constructor = MouseEvent)| (Typeof (arg0) = "object" arg0.preventDefault arg0.stopPropagation )){Return arg0;}}Fun
The event types in android include button events and screen Touch events. Touch events are the basic events of screen Touch events, so it is necessary to have a deep understanding of them.A simple screen Touch action triggers a series of Touch events: ACTION_DOWN-> ACTION_MOVE...-> ACTION_MOVE-> ACTION_UPWhen the screen contains a ViewGroup and the ViewGroup contains a sub-view, how does the android system handle Touch events? Is ViewGroup used to process Touch events or child views used to proc
If you constrain a div's draggable range to a specified element:Drag effect everyone may be familiar with, but usually the drag range is limited, through an example code to explain how to drag a div to a specified range of elements, code example is as follows:DOCTYPE HTML> HTML> Head> MetaCharSet= "Utf-8"> Metaname= "Author"content= "http://www.softwhy.com/" /> title>Ant Tribetitle> styletype= "Text/css">#box{width:400px;Height:300px;Background-color:Red;margin:0px Auto;position:relative;}#drag{
Event-driven mechanism is widely used in embedded systems, similar to the interrupt mechanism, when an event arrives (such as a key, data arrives), the system responds to and processes the event. With respect to the polling mechanism, the event mechanism has the advantage of being a star, with low power consumption (the system is in hibernation and is awakened when an event arrives) and MCU utilization is high.Contiki the event mechanism into the protothreads mechanism, where each event binds to
based on the waiting conditions: if there are still read and write requests waiting, it is not triggered; if only the Read Request is waiting, then, it is triggered again so that other read requests can enter. over and over again, I decided to adopt manual events. After all, the number of read locks is much larger than the number of write locks (this is also a common scenario for read/write locks) faster (no need to wait for multiple events ).
Appendix 1-C ++ code
# Define RWLOCK_IDLE 0/* idle
to a new location. It correctly handles this situation: when the first finger dragged the control to a position, then pressed the second finger, and the second finger and the same control. When the user raises the first finger, the control does not run to the second finger and the second finger can continue to drag the control.
// The ‘active pointer’ is the one currently moving our object.private int mActivePointerId = INVALID_POINTER_ID;@Overridepublic boolean onTouchEvent(MotionEvent
The div layer moving with the mouse uses ieff. You can pay attention to compatibility issues. . Center_p2
{
Position: absolute;
Z-index: 1;
Text-align: center;
Display: none;
Background-color: # e0e7ef;
}
. Center_p_tips2
{
Position: relative;
Color: Red;
}
Updating data...
The Code is as follows:
Function IsIE (){Var OsObject = "";If (navigator. userAgent. indexOf ("MSIE")> 0 ){Return true;}}Function mouseMove (ev ){/* The event mechanism of i
content in richtextbox1 to the fileM_streamwriter.write (richtextbox1.text );// Close this fileM_streamwriter.flush ();M_streamwriter.close ();
How to Implement print preview:
Print preview is implemented through the print preview dialog box. To print and preview a text file after reading, the most important thing is to notify the print preview dialog box of the content of the file to be previewed. The following code displays the content displayed in richtextbox1 in the print preview dialog
How does js disable the Backspace key to bring the browser back? jsbackspace
In the project, if you press the Backspace key to bring the browser back, several solutions are not ideal. Therefore, the wisdom of the masses and the wisdom of the family are summarized as follows:
1. Define the method to block Backspace in public js
Function banBackSpace (e) {var ev = e | window. event; // obtain the event object var obj =
trigger, not afraid, we have a trick:The event object provides a property called Target, which can return the destination node of the event, we become the source of the event, that is, the target can be represented as the DOM of the current event operation, but not actually manipulating the DOM, of course, this is compatible, Standard browser with Ev.target,ie browser with Event.srcelement, at this time just get the position of the current node, do not know what node name, here we use nodename
action triggers a series of touch events: ACTION_DOWN->ACTION_MOVE->...->ACTION_MOVE->ACTION_UPFor this event distribution mechanism in Android, this event refers to Motionevent. The distribution of the view's events is also a distribution operation to Motionevent. You can use GETRAWX and Getrawy to get the horizontal ordinate of events relative to the upper-left corner of the screen. Gets the horizontal ordinate of the event relative to the upper-left corner of the current view through Getx ()
Yesterday to do something to touch the event conflict, before also often encounter event conflict, think to study the Android event conflict mechanism, so from yesterday to today to a full day to understand this knowledge, this only understand the Android touch and click event mechanism. Explore the following:First rewrite the three view layouts for testing: Packagecom.example.yzj.android_8_10;ImportAndroid.content.Context;ImportAndroid.util.AttributeSet;ImportAndroid.util.Log;Importandroid.
, of course, this is compatible, Standard browser with Ev.target,ie browser with Event.srcelement, at this time just get the position of the current node, do not know what node name, here we use nodename to get exactly what tag name, this return is a uppercase, we need to turn to lowercase to do comparison (habit problem):Window.onload = function () {var Oul = document.getElementById ("Ul1");Oul.onclick = function (EV) {var
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service