Aplication Authors


Ir a la página 1, 2  Siguiente

Objetivo: Aplication Authors
Hola.
Si se fijan en Herramientas/Preferencias/Fragmantos de código y luego en gpl veran que existe algo así:

${1:$TITLE}
${2:$DESCRIPTION}
Copyright (C) ${3:$AUTHORS}


Luego en el editor de gambas se puede usar:
Application.Dir
Application.Env.Count
Application.Handle
Application.Id
Application.Name
Application.Path
Application.Return
Application.Title
Application.Version

Pero lo que no esta es algo así como Application.Author

¿Cual es la variable o clase que devuelve los autores del programa?

Saludos.

Perfil MP  
Objetivo: Re: Aplication Authors
Bueno luego de fracasar en el intentento de encontrar alguna forma nativa en gambas para poner los autores del proyecto, decidi hacer una funcion para ello.
Public Function PrInfo() As String[] ''Devuelve una matriz con la información del projecto alojada en el archivo ".project", donde el orden de cada item es el siguiente:
'0 Title
'1 Description
'2 Authors
'3 Vendor
'4 Version
'5 Component
'6 Language
'7 Startup
'8 Icon

Dim stxKeys As New String[]
Dim stxInfo As New String[]
Dim strProject As String
Dim stxTmp As New String[]
Dim stxTag As New String[]
Dim stxVal As New String[]
Dim int As Integer
Dim key As Integer
Dim tag As Integer
Dim strVal As String
Dim intCount As Integer

stxKeys.Add("Title")
stxKeys.Add("Description")
stxKeys.Add("Authors")
stxKeys.Add("Vendor")
stxKeys.Add("Version")
stxKeys.Add("Component")
stxKeys.Add("Language")
stxKeys.Add("Startup")
stxKeys.Add("Icon")

stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")

If Exist(".project") Then
strProject = File.Load(".project")
stxTmp = Split(strProject, "\n")
For int = 0 To stxTmp.Max
If InStr(stxTmp[int], "=") > 0 Then
Select Split(stxTmp[int], "=")[0]
Case "Title", "Startup", "Icon", "Version", "Component", "Description", "Authors", "Language", "Vendor"
stxTag.Add(Split(stxTmp[int], "=")[0])
strVal = Replace(Split(stxTmp[int], "=")[1], Chr(34), "")
strVal = Replace(strVal, "\n", ":")
stxVal.Add(strVal)
End Select
Endif
Next
Endif
If stxTag.Count > 0 Then
For key = 0 To stxKeys.Max
intCount = 0
For tag = 0 To stxTag.max
If stxTag[tag] = stxKeys[key] Then
Select intCount
Case 0
stxInfo[key] &= stxVal[tag]
Case Else
stxInfo[key] &= ":" & stxVal[tag]
End Select
Inc intCount
Endif
Next
Next
Endif
Return stxInfo
End


La incluiré en el compilado de funciones.

Saludos.

Perfil MP  
Objetivo: Re: Aplication Authors
Hola Tincho

¿Nos puedes explicar para qué es esto?:

stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")
stxInfo.Add("")


Añades 9 elementos vacíos a un array string, pero para qué?

Saludos

Perfil MP  
Objetivo: Re: Aplication Authors
jguardon escribió: [Ver mensaje]
Hola Tincho
¿Nos puedes explicar para qué es esto?:
.....
Añades 9 elementos vacíos a un array string, pero para qué?


Es para que luego pueda editar la posición sin tener que agregarla.

Si quiero hacer, por ejemplo, esto: stxInfo[key] = "texto" pero la array no tiene la posicion key el programa fallara.

Saludos.

Perfil MP  
Objetivo: Re: Aplication Authors
¿Por qué no usas colecciones? Son auto-explicativas y mucho más flexibles...

Perfil MP  
Objetivo: Re: Aplication Authors
shordi escribió: [Ver mensaje]
¿Por qué no usas colecciones? Son auto-explicativas y mucho más flexibles...

No me terminan de convencer las colecciones. Las listas se pueden recorrer con un numero entero en cambio las colecciones se deben recorrer con la estructura "for each" ya que el indice es un texto.
Luego las colecciones no tienen algunos medos muy interesante como Sort o Join, entre otros.

COlecciones
Properties
  1. Count
  2. Default
  3. Key
  4. Length


Methods
  1. Add
  2. Clear
  3. Copy
  4. Exist
  5. Remove


Properties
  1. Bounds
  2. Count
  3. Data
  4. Dim
  5. Length
  6. Max
  7. Type

Methods
  1. Add
  2. Clear
  3. Copy
  4. Delete
  5. Exist
  6. Extract
  7. Fill
  8. Find
  9. Insert
  10. Join
  11. Pop
  12. Push
  13. Remove
  14. Resize
  15. Reverse
  16. Sort


Es decir la lista frente a la colección tiene 11 métodos más.

Saludos.

Perfil MP  
Objetivo: Re: Aplication Authors
Citar:
Es decir la lista frente a la colección tiene 11 métodos más.

¿y cuántos de esos métodos usas en este código? Hay que utilizar cada vez lo que sea más conveniente al problema, digo.

Perfil MP  
Objetivo: Re: Aplication Authors
shordi escribió: [Ver mensaje]
Citar:
Es decir la lista frente a la colección tiene 11 métodos más.

¿y cuántos de esos métodos usas en este código? Hay que utilizar cada vez lo que sea más conveniente al problema, digo.

Como te comentaba antes uso .Join, .Sort y también uso .Insert y .Find. ninguno de estos métodos esta disponible en las colecciones.

Saludos.

Perfil MP  
Objetivo: Re: Aplication Authors
Citar:

Como te comentaba antes uso .Join, .Sort y también uso .Insert y .Find. ninguno de estos métodos esta disponible en las colecciones.

No en el código que muestras...

Perfil MP  
Objetivo: Re: Aplication Authors
Tincho:

Citar:
uso .Join, .Sort y también uso .Insert y .Find.

Se podían implementar en una nueva clase.

Yo implemente recorrer colecciones como si fueran un array:
http://jsbsan.blogspot.com.es/2014/...iones-como.html


Saludos

Ir a la página 1, 2  Siguiente

Página 1 de 2


  
No puede crear mensajes
No puede responder temas
No puede editar sus mensajes
No puede borrar sus mensajes
No puede votar en encuestas
No puede adjuntar archivos
Puede descargar archivos
No puede publicar eventos en el calendario

   

Está utilizando la versión (Lo-Fi). Para ver la versión completa del foro, haga clic aquí.

Powered by Icy Phoenix based on phpBB
Design by DiDiDaDo

Página generada en:: 0.4101s (PHP: -66% SQL: 166%)
Consultas SQL: 44 - Debug off - GZIP Activado