Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Foreign Languages > Spanish Forum
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Control IMAGE

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-12-2007, 03:56 PM
Junior Member
 
Join Date: Nov 2007
Posts: 15
Default Control IMAGE

Hola a todos,

estoy intentando realizar un programilla para aprender las notas musicales y esta parte me da problemas.
Me podriais ayudar?

Sub Globals
'Declare the global variables here.
Dim Img(28)
Dim i, w, x, y, z
End Sub

Sub App_Start
Form1.Show
y=0
Z=0

Img(0)=Image1.Image 'Do3
Img(1)=Image2.Image 'Re3
Img(2)=Image3.Image 'Mi3
Img(3)=Image4.Image 'Fa3
Img(4)=Image5.Image 'Sol3
Img(5)=Image6.Image 'La3
Img(6)=Image7.Image 'Si3
Img(7)=Image8.Image 'Do4
Img(8)=Image9.Image 'Re4
Img(9)=Image10.Image 'Mi4
Img(10)=Image11.Image 'Fa4
Img(11)=Image12.Image 'Sol4
Img(12)=Image13.Image 'La4
Img(13)=Image14.Image 'Si4
Img(14)=Image15.Image 'Do5
Img(15)=Image16.Image 'Re5
Img(16)=Image17.Image 'Mi5
Img(17)=Image18.Image 'Fa5
Img(18)=Image19.Image 'Sol5
Img(19)=Image20.Image 'La5
Img(20)=Image21.Image 'Si5
Img(21)=Image22.Image 'Do6
Img(22)=Image23.Image 'Re6
Img(23)=Image24.Image 'Mi6
Img(24)=Image25.Image 'Fa6
Img(25)=Image26.Image 'Sol6
Img(26)=Image27.Image 'La6
Img(27)=Image28.Image 'Si6
textbox5.Text= ArrayLen (Img())
x=Rnd(0, ArrayLen (Img())-1)
textbox3.Text = x
For i=0 To ArrayLen(Img())-1
If i=x Then
Control("Image" & i).visible=true
End If
Next
End Sub

Sub Button8_Click
For i=0 To ArrayLen(Img())-1
If ControlType(Img(i)) = "Image" Then
Control("Image" & i).visible=false
End If
Next
For i=0 To ArrayLen(Img())-1
Control("Image" & i).visible=false
Next
textbox5.Text= ArrayLen (Img())
x=Rnd(0, ArrayLen (Img())-1)
textbox3.Text = x
For i=0 To ArrayLen(Img())-1
If i=x Then
Control("Image" & i).visible=true
End If
Next
End Sub

Gracias por todo
Saludos
Joserra
Reply With Quote
  #2 (permalink)  
Old 11-12-2007, 08:38 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

As postado tu codigo, pero no tu problema....
Que és que intentas hacer y no lo consegues?

Poxima vez, hace un upload del file spb generado por el IDE, es mas sencillo de testar...
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
  #3 (permalink)  
Old 11-13-2007, 12:47 PM
Junior Member
 
Join Date: Nov 2007
Posts: 15
Default

Perdon por el descuido

Repito todo

estoy intentando realizar un programilla para aprender las notas musicales y esta parte me da problemas.
Me podriais ayudar?

Sub Globals
'Declare the global variables here.
Dim Img(28)
Dim i, w, x, y, z
End Sub

Sub App_Start
Form1.Show
y=0
Z=0

'Introduzco las imagenes en el array (estan todas marcadas como no visibles)
Img(0)=Image1.Image 'Do3
Img(1)=Image2.Image 'Re3
Img(2)=Image3.Image 'Mi3
Img(3)=Image4.Image 'Fa3
Img(4)=Image5.Image 'Sol3
Img(5)=Image6.Image 'La3
Img(6)=Image7.Image 'Si3
Img(7)=Image8.Image 'Do4
Img(8)=Image9.Image 'Re4
Img(9)=Image10.Image 'Mi4
Img(10)=Image11.Image 'Fa4
Img(11)=Image12.Image 'Sol4
Img(12)=Image13.Image 'La4
Img(13)=Image14.Image 'Si4
Img(14)=Image15.Image 'Do5
Img(15)=Image16.Image 'Re5
Img(16)=Image17.Image 'Mi5
Img(17)=Image18.Image 'Fa5
Img(18)=Image19.Image 'Sol5
Img(19)=Image20.Image 'La5
Img(20)=Image21.Image 'Si5
Img(21)=Image22.Image 'Do6
Img(22)=Image23.Image 'Re6
Img(23)=Image24.Image 'Mi6
Img(24)=Image25.Image 'Fa6
Img(25)=Image26.Image 'Sol6
Img(26)=Image27.Image 'La6
Img(27)=Image28.Image 'Si6

'Compruebo que estan todas
textbox5.Text= ArrayLen (Img())

'Selecciono una aleatoriamente
x=Rnd(0, ArrayLen (Img())-1)

'Compruebo que correponde
textbox3.Text = x

'Le digo al programa que la haga visible
For i=0 To ArrayLen(Img())-1
If i=x Then
Control("Image" & i).visible=true
End If
Next
End Sub

'Hasta aquí todo sin problemas.

El botton 8 tiene que seguir el programa y ocultar la nota visible haciendo aparecer otra segun corresponda pero poniendo los contadores de aciertos y fallos, ya existentes, a cero.

Sub Button8_Click
For i=0 To ArrayLen(Img())-1
Control("Image" & i).visible=false
Next
textbox5.Text= ArrayLen (Img())
x=Rnd(0, ArrayLen (Img())-1)
textbox3.Text = x
For i=0 To ArrayLen(Img())-1
If i=x Then
Control("Image" & i).visible=true
End If
Next
End Sub

Cuando hacemos 'run' ocurre mensaje de error en 'button8':

Control("Image" & i).visible=false

Referencia a objeto no establecida como instancia de un objeto


¿Porque aquí, si antes he usado la misma expresion y me la ha aceptado?

Gracias por todo
Saludos
Joserra
Reply With Quote
  #4 (permalink)  
Old 11-13-2007, 02:48 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

porque no utilizas un DoUntil?
desta forma las intruciones seguintes se repetem asta que la expression sea True....es mas sencillo de programar...
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
  #5 (permalink)  
Old 11-14-2007, 12:40 PM
Junior Member
 
Join Date: Nov 2007
Posts: 15
Default

Gracias por responderme tan rapido.

Realmente tienes razon, pero de esta forma me encuentro mas comodo, aunque eso no quita que luego, una vez visto que todo funciona, lo intente optimizar.

De todas forma y como intentaba explicar, mi problema radica en:

"Cuando hacemos 'run' ocurre mensaje de error en 'button8':

Control("Image" & i).visible=false

Referencia a objeto no establecida como instancia de un objeto

¿Porque aquí, si antes he usado la misma expresion y me la ha aceptado?"

Saludos
Reply With Quote
  #6 (permalink)  
Old 11-14-2007, 05:58 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

posta el file completo del codigo, com ele form...(el spb file), para que possa editarlo e "ver" el error!!!
puede ser que la a apginas tantas, el control image x devuelva vazio o no existente!
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
draw line into image control giannimaione Questions (Windows Mobile) 4 06-03-2008 04:40 PM
Drawing on image control derez Basic4ppc Wishlist 10 01-16-2008 04:51 PM
Move an image inside an image control Cableguy Questions (Windows Mobile) 5 05-14-2007 07:40 PM


All times are GMT. The time now is 01:01 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0