Page 3 sur 3
Re: Input en Drawing 2D
Publié : jeu. 11/mars/2021 9:00
par PCPixMusic
Bonjour,
Wahou j'y suis presque.
Rempalce et simul un chargement de fichier SQlite pour ce test :
Code : Tout sélectionner
Contact_prenom_dim(0) = "Marie"
Contact_prenom_dim(1) = "Julie"
Contact_prenom_dim(2) = "Antoine"
Contact_prenom_dim(3) = "Paul"
Contact_nom_dim(0) = "La Flûte"
Contact_nom_dim(1) = "Joly"
Contact_nom_dim(2) = "Bureau"
Contact_nom_dim(3) = "Lemeur"
- Bug: La première ligne ne s'affiche pas avec Drawtext
- StringGadget décale d'une ligne l'affichage (les variables du tableau de la première igne s'affiche à partir de la deuxième)
- Sur la première ligne l'affichage est aléatoire et les cellules vide affichent le contenue de l'index zéro des autres variables du tableau.
Nouveau code à jour
https://www.mianubo.fr/s/ELbM5BHiwTNkEWz
Merci à qui pourra résoudre ce bug mathématique ...
Ensuite ça ira plus vite, on peux le faire.
Bonne journée.

Re: Input en Drawing 2D
Publié : jeu. 11/mars/2021 9:09
par kernadec
bjr PCPixMusic
avec pb sous Windows
debug #NM_FIRST = 0
debug #NM_CUSTOMDRAW = - 12
le ligne 20: #NM_CUSTOMDRAW = #NM_FIRST - 12
ne fait que s'assurer que la constante #NM_CUSTOMDRAW sera bien a " - 12 "
[Réédit]
je viens de penser a un truc, sous émulation Windows les constante Windows
sont peut être protégées, alors il se pourrait qu'on ne puisse pas modifier
leurs contenus, donc essaye de mettre cette ligne 20 en commentaire.
je viens de regarder ton code je pense que c'est problème d'index quand tu clique sur une case
c 'est le précédent nom qui est édité
perso, j'utiliserais une liste structurée à la place d'un tableau..
pour justement cette gestion des nom avec les commandes "List" c 'est plus facile
Cordialement
Re: Input en Drawing 2D
Publié : jeu. 11/mars/2021 9:15
par Mesa
Ligne 252, retrancher 1 à l'index
Code : Tout sélectionner
DrawText(62 ,inc,Contact_prenom_dim(Ligne_Index-1))
DrawText(242 ,inc,Contact_nom_dim(Ligne_Index-1))
DrawText(422 ,inc,Contact_entreprise_dim(Ligne_Index-1))
DrawText(602 ,inc,Contact_adresse_dim(Ligne_Index-1))
DrawText(782 ,inc,Contact_code_postal_dim(Ligne_Index-1))
DrawText(962 ,inc,Contact_ville_dim(Ligne_Index-1))
DrawText(1142,inc,Contact_pays_dim(Ligne_Index-1))
DrawText(1322,inc,Contact_telephone_dim(Ligne_Index-1))
DrawText(1502,inc,Contact_mail_dim(Ligne_Index-1))
DrawText(1682,inc,Contact_site_dim(Ligne_Index-1))
M.
Re: Input en Drawing 2D
Publié : jeu. 11/mars/2021 9:19
par Mesa
Ligne 870, tu peux ajouter
pour éviter le bug d'affichage quand on clique sur une case blanche.
M.
Re: Input en Drawing 2D
Publié : jeu. 11/mars/2021 9:36
par PCPixMusic
Bonjour Mesa,
Je viens de corriger
https://www.mianubo.fr/s/xB3cfNm7YNtJ5FS
Ligne 226 :
Rempacer
inc = 36
Par
inc = 3
Puis ton ajout
Ligne 870, tu peux ajouter
Code:
SetGadgetText(#String,"")
Il n'y a donc plus de décalage entre l'affichage DrawText et le StringGadget
Il ne me reste plus quà réglé le problème de la première ligne qui ne s'affiche pas avec DrawText.
Puis faire en sorte que l'affichage de DrawText soit bein actualisé une fois une modification de saisie faites dans StringGadget.
Mais je suis content, c'est incroyable déjà.
C'est passionant.

Re: Input en Drawing 2D
Publié : jeu. 11/mars/2021 14:09
par Mesa
Code : Tout sélectionner
Procedure Affiche_Cellules() ; Affiche le contenu des cellules
Protected.i Ligne_Index,inc
inc = 3;<====================
For Ligne_Index = 0 To 1000
inc = inc + 33
DrawText(62 ,inc,Contact_prenom_dim(Ligne_Index))
DrawText(242 ,inc,Contact_nom_dim(Ligne_Index))
DrawText(422 ,inc,Contact_entreprise_dim(Ligne_Index))
DrawText(602 ,inc,Contact_adresse_dim(Ligne_Index))
DrawText(782 ,inc,Contact_code_postal_dim(Ligne_Index))
DrawText(962 ,inc,Contact_ville_dim(Ligne_Index))
DrawText(1142,inc,Contact_pays_dim(Ligne_Index))
DrawText(1322,inc,Contact_telephone_dim(Ligne_Index))
DrawText(1502,inc,Contact_mail_dim(Ligne_Index))
DrawText(1682,inc,Contact_site_dim(Ligne_Index))
Next
EndProcedure
Code : Tout sélectionner
Procedure Copy_String_To_Cellule_() ; Scan des cellules Après une saisie
Protected.i Ligne_Index, Xg,Yg
Xg = GadgetX(#String,#PB_Gadget_ContainerCoordinate)
Yg = GadgetY(#String,#PB_Gadget_ContainerCoordinate)
inc = 3;<===========================
For Ligne_Index = 0 To 1000
inc = inc + 33
If Xg = 62 And Yg = inc : Contact_prenom_dim(ligne_index) = GetGadgetText(#String) : EndIf
If Xg = 242 And Yg = inc : Contact_nom_dim(ligne_index) = GetGadgetText(#String) : EndIf
If Xg = 422 And Yg = inc : Contact_entreprise_dim(ligne_index) = GetGadgetText(#String) : EndIf
If Xg = 602 And Yg = inc : Contact_adresse_dim(ligne_index) = GetGadgetText(#String) : EndIf
If Xg = 782 And Yg = inc : Contact_code_postal_dim(ligne_index) = GetGadgetText(#String) : EndIf
If Xg = 962 And Yg = inc : Contact_ville_dim(ligne_index) = GetGadgetText(#String) : EndIf
If Xg = 1142 And Yg = inc : Contact_pays_dim(ligne_index) = GetGadgetText(#String) : EndIf
If Xg = 1322 And Yg = inc : Contact_telephone_dim(ligne_index) = GetGadgetText(#String) : EndIf
If Xg = 1502 And Yg = inc : Contact_mail_dim(ligne_index) = GetGadgetText(#String) : EndIf
If Xg = 1682 And Yg = inc : Contact_site_dim(ligne_index) = GetGadgetText(#String) : EndIf
Next
EndProcedure
Code : Tout sélectionner
Case #PB_Event_Gadget
Select EventGadget()
Case #Fenetre_Saya
SourisX = GetGadgetAttribute(#Fenetre_Saya, #PB_Canvas_MouseX)
SourisY = GetGadgetAttribute(#Fenetre_Saya, #PB_Canvas_MouseY)
Case #String
Select EventType()
Case #PB_EventType_Change
Debug GetGadgetText(#String)
Copy_String_To_Cellule_();<===========================
EndSelect
M.
Re: Input en Drawing 2D
Publié : jeu. 11/mars/2021 19:45
par PCPixMusic
Bonsoir @Mesa
Merci beaucoup pour ces corrections.
Surtout j'avais complètement oublié de mettre Copy_String_To_Cellule_() dans la case #String. ^^
Dans les prochains jours :
- J'ajusterais une plus jolie police de caractères pour l'affichage avec DrawText.
- Je mettrais en place la gestion SQlite.
Derière maj avec corrections et ajustement des polices de caractères :
https://www.mianubo.fr/s/J9Q9zStqzJwDLkE
Encore merci à tous et à bientôt.
Passez une très bonne soirée.