Page 16 of 43
Re: he conseguido un iphone
Posted: Mon Nov 01, 2010 8:54 am
by Antonio Linares
Añadida la primera implementación de la Clase TPickerView y samples/picker.prg
Code: Select all | Expand
function Main()
local oWnd := TWindow():New()
local aItems := { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }
local oPicker := TPickerView():New( oWnd, aItems, 50, 0, 200, 200 )
oWnd:Activate()
return nil

Re: he conseguido un iphone
Posted: Mon Nov 01, 2010 3:26 pm
by mastintin
Antonio , Daniel ... revisando codigo me encuentro en mainapp.m varios "int" , justo he leido esto
http://www.nscodecenter.com/preguntas/58/cual-es-la-diferencia-entre-nsinteger-y-nsuinteger¿ Se debería cambiar no ? .
Saludos.
Re: he conseguido un iphone
Posted: Mon Nov 01, 2010 3:50 pm
by Antonio Linares
Manuel,
Depende del uso que se les de.
En el caso del TPickerView, se usa para pasar los elementos de un array al picker, y siempre va a ser un array con un numero de elementos no muy grande

El problema viene cuando intentemos almacenar un valor muy grande en ellos. Por ejemplo, en FWH 64 tenemos que usar valores tipo "longlong" (64 bits) porque en un long (32 bits) no caben algunos valores de 64 bits (handles, principalmente).
Re: he conseguido un iphone
Posted: Mon Nov 01, 2010 4:07 pm
by Daniel Garcia-Gil
Manuel
revisando la
documentacion de appleposiblemente podriamos resolverlo con typedef sin cambiar el codigo
NSInteger
Used to describe an integer.
#if __LP64__ || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef long NSInteger;
#else
typedef int NSInteger;
#endif
Discussion
When building 32-bit applications, NSInteger is a 32-bit integer. A 64-bit application treats NSInteger as a 64-bit integer.
NSUInteger
Used to describe an unsigned integer.
#if __LP64__ || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef unsigned long NSUInteger;
#else
typedef unsigned int NSUInteger;
#endif
Discussion
When building 32-bit applications, NSUInteger is a 32-bit unsigned integer. A 64-bit application treats NSUInteger as a 64-bit unsigned integer
Re: he conseguido un iphone
Posted: Mon Nov 01, 2010 7:04 pm
by mastintin
He subido al repositorio una nueva version de msgs.m . Esta implementado el MsgYesNoModal para que devuelva el numero de boton que se ha pulsado , pero no consiguo que me devuelva un número ... seguro que es una tontada pero estoy ofuscado y no consiguo terminarlo asi que aqui lo dejo ....
Si quereis hecharle un vistazo ...
Saludos.
-------------------------- editado--------------------
Resuelto . Ya esta funcionando msgYesNoModal..... , añadidas funciones MsgActivity() y delMsgActivity() mensajes sin boton y con un control activity ...
Un saludo.
Re: he conseguido un iphone
Posted: Mon Nov 01, 2010 9:20 pm
by Antonio Linares
Manuel,
Muy bien, gracias!

Has visto algo de los sensores de proximidad, de aceleración, de movimiento ?
Re: he conseguido un iphone
Posted: Mon Nov 01, 2010 10:33 pm
by mastintin
Antonio Linares wrote:Manuel,
Muy bien, gracias!

Has visto algo de los sensores de proximidad, de aceleración, de movimiento ?
He encontrado este codigo que puede servir de comienzo:
Code: Select all | Expand
#define kAccelerationThreshold 2.2
//Somewhere in initialization
UIAccelerometer *accel = [UIAccelerometer sharedAccelerometer];
accel.delegate = self;
accel.updateInterval = 1.0f/10.0f;
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
if (fabsf(acceleration.x) > kAccelerationThreshold || fabsf(acceleration.y) > kAccelerationThreshold || fabsf(acceleration.z) > kAccelerationThreshold) {
NSLog(@"Shaking!!!");
}
}
Re: he conseguido un iphone
Posted: Tue Nov 02, 2010 8:42 am
by mastintin
Antonio Linares wrote:Manuel,
Muy bien, gracias!

Has visto algo de los sensores de proximidad, de aceleración, de movimiento ?
Añadida funcion de ajuste del sensor de proximidad ...SetProxiMonitor( lactivardesactivar) .
No está aun probado y no se si funciona bien ( se me atraganta algo el pasar parametros bool

)
Saludos.
Re: he conseguido un iphone
Posted: Tue Nov 02, 2010 6:24 pm
by mastintin
por cierto en encontrado esto que nos puede venir muy bien

he visto que tenemos mal el codigo de control de color ya que alpha no divide entre 255

)
Code: Select all | Expand
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
Re: he conseguido un iphone
Posted: Tue Nov 02, 2010 7:43 pm
by Antonio Linares
Manuel,
Creo que lo tenemos bien. Según la documentación de la Clase UIColor:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIColor_Class/Reference/Reference.htmlParameters
red
The red component of the color object, specified as a value from 0.0 to 1.0.
green
The green component of the color object, specified as a value from 0.0 to 1.0.
blue
The blue component of the color object, specified as a value from 0.0 to 1.0.
alpha
The opacity value of the color object, specified as a value from 0.0 to 1.0.
Todos los valores van de 0 a 1, y es correcto dividir por 255, si queremos usar un rango de 0 a 255

Re: he conseguido un iphone
Posted: Tue Nov 02, 2010 7:53 pm
by Antonio Linares
mastintin wrote:Antonio Linares wrote:Manuel,
Muy bien, gracias!

Has visto algo de los sensores de proximidad, de aceleración, de movimiento ?
Añadida funcion de ajuste del sensor de proximidad ...SetProxiMonitor( lactivardesactivar) .
No está aun probado y no se si funciona bien ( se me atraganta algo el pasar parametros bool

)
Saludos.
Manuel,
Ligeramente modificado. Los valores lógicos los pasamos usando hb_parl()

Re: he conseguido un iphone
Posted: Tue Nov 02, 2010 7:58 pm
by mastintin
Antonio Linares wrote:Manuel,
Creo que lo tenemos bien. Según la documentación de la Clase UIColor:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIColor_Class/Reference/Reference.htmlParameters
red
The red component of the color object, specified as a value from 0.0 to 1.0.
green
The green component of the color object, specified as a value from 0.0 to 1.0.
blue
The blue component of the color object, specified as a value from 0.0 to 1.0.
alpha
The opacity value of the color object, specified as a value from 0.0 to 1.0.
Todos los valores van de 0 a 1, y es correcto dividir por 255, si queremos usar un rango de 0 a 255

Correcto para los colores , pero el canal alfa ( opacidad) creo que es mas "comprensible" si se usa de 0 a 100 ( porcentaje de opacidad ), como hace por ejemplo photoshop . ¿ no? .
Re: he conseguido un iphone
Posted: Tue Nov 02, 2010 11:07 pm
by Antonio Linares
Manuel,
Es que en realidad usar un rango de 0.0 a 1.0 es un porcentaje también, pero en distinta escala.
Nosotros podemos usar la escala que queramos, pero tendremos que traducirla a la de ellos

Re: he conseguido un iphone
Posted: Tue Nov 02, 2010 11:55 pm
by Antonio Linares
Subida la Clase TAcceleroMeter basada en el código publicado por Manuel

y samples/accel.prg
Aún no funciona, pero ya lo solucionaremos

Code: Select all | Expand
function Main()
local oWnd := TWindow():New(), oAccel
TLabel():New( oWnd, "Shake me!" )
oAccel = TAcceleroMeter():New()
oAccel:bShaking = { || MsgInfo( "shaking!" ) }
oWnd:Activate()
return nil
Re: he conseguido un iphone
Posted: Wed Nov 03, 2010 12:16 am
by Antonio Linares
Arreglado, solo habia que variar la cantidad de acceleración

#define kAccelerationThreshold 1.07