alino74 Pubblicato: 28 Dicembre 2010 Segnalazione Share Pubblicato: 28 Dicembre 2010 Ciao raga! primi passi in mshell... Riporto questo semplice script x controllare la pressione del touchscreen... if toccato -> restituisce un array con le coordinate del tocco else -> restituisce null ciao ciao! use ui; /* =========== touchpressed ============== Controlla la pressione del touchscreen... if toccato -> restituisce un array con le coordinate del tocco else -> restituisce null */ function touchpressed(); /* attiva l'interesse x l'evento "touch screen"... ui.relative= restituisce le coordinate relative al pt di pressione */ ui.ptr(ui.relative); /* verifica la pressione del touchscreen... se toccato, allora: c[0]=x c[1]=y c[2]=0 -> evento generato da bottone1 (mask x pennino!) altrimenti c=null */ c=ui.cmd(); // touch? (c=null se nessun tocco!) ui.ptr(0); // diattiva l'interesse x l'evento "touch screen"... if c#null and c[2]=0 then return [c[0],c[1]] else return null end; end; // =========== touchpressed ============== // =========== MAIN ====================== print "Tocca lo schermo...."; do s=touchpressed(); if s#null then // ho toccato lo schermo... print "PREMUTO: ", s end until false Link to comment Condividi su altri siti More sharing options...
Nick_7 Pubblicato: 28 Dicembre 2010 Segnalazione Share Pubblicato: 28 Dicembre 2010 Bravo davvero niente male, appena ho un attimo ti posto un ottimo esempio preso dal sito di mShell Link to comment Condividi su altri siti More sharing options...
Nick_7 Pubblicato: 29 Dicembre 2010 Segnalazione Share Pubblicato: 29 Dicembre 2010 Eccolo qui: use ui, proc const command1 = "Hello World"; const command2 = "Clear Screen"; const command3 = "Exit"; ui.menu("Events Handler", [.command1, .command2, .command3]); ui.keys(ui.strokes); ui.ptr(ui.absolute); while true do cmd = ui.cmd(1800000); // 30 min. if isarray(cmd) then // pointer events. x = cmd[0]; y = cmd[1]; state = cmd[2]; if state = 1 then // handle pointer down events. print "ptr down " + cmd; elsif state = 0 then // handle pointer up events. print "ptr up " + cmd; end; elsif isnum(cmd) then // handle key events. // for example: if cmd = 13 then // do something ... end; print "key " + cmd; elsif isstr(cmd) then // handle menu events. if cmd = .command1 then print "Hello World"; elsif cmd = .command2 then cls(); elsif cmd = .command3 then proc.stop(); end; else // ignor or handle null events. end; end; È molto interessante e utile Link to comment Condividi su altri siti More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Accedi Ora