Bonjour à tous,
Je m'intéresse à spiderbasic (surtout pour le développement android) , mais la je suis assez perplexe dans la gestion des activités, des layout etc.
Alors si quelqu'un a un petit bout de code d'un petite appli android ce serais sympa.
spiderbasic android
- microdevweb
- Messages : 1798
- Inscription : mer. 29/juin/2011 14:11
- Localisation : Belgique
spiderbasic android
Windows 10 64 bits PB: 5.70 ; 5.72 LST
Work at Centre Spatial de Liège
Work at Centre Spatial de Liège
- falsam
- Messages : 7244
- Inscription : dim. 22/août/2010 15:24
- Localisation : IDF (Yvelines)
- Contact :
Re: spiderbasic android
Ne soit pas inquiet. Je te propose ce code que j'ai proposé à un utilisateur qui souhaitait faire du scrolling automatique (de haut en bas) dans un textgadget.
J'ai crée un APK et testé sur un smartphone en portrait et paysage. Aucun souci d'ajustement.
Paramétrage de l'application.
L'application n'étant pas signée tu es obligé de laisser le débogueur activé.
Astuce : Tu peux ne pas afficher la fenêtre de débogage dans l'application avec l'instruction CloseDebugOutput() en début de code.
J'ai crée un APK et testé sur un smartphone en portrait et paysage. Aucun souci d'ajustement.
Code : Tout sélectionner
EnableExplicit
Enumeration
#mf
#mfHistory
#mfMessage
#mfSend
EndEnumeration
Global w, h, Selector, cr.s = "<br>"
Declare onSendMessage()
Declare onResize()
;Window (Full Screen)
OpenWindow(#mf, 0, 0, 0, 0, "", #PB_Window_Background)
w = WindowWidth(#mf)
h = WindowHeight(#mf)
;User history
TextGadget(#mfHistory, 0, 20, w, h - 100, "Welcome. Type your message and press enter (<em>or button Send</em>)")
SetGadgetColor(#mfHistory, #PB_Gadget_BackColor, RGB(192, 192, 192))
;Insert vertical/horizontal scrollbar
Selector = GadgetID(#mfHistory)
!$(v_selector.div).css("overflow", "scroll")
;User message
StringGadget(#mfMessage, 0, h - 70, w-100, 24, "Your message", #PB_String_PlaceHolder)
ButtonGadget(#mfSend, w - 95, h - 70, 80, 24, "Send")
AddKeyboardShortcut(#mf, #PB_Shortcut_Return, #mfSend)
;Triggers
BindEvent(#PB_Event_Menu, @onSendMessage(), #mf, #mfSend)
BindGadgetEvent(#mfSend, @onSendMessage())
BindEvent(#PB_Event_SizeDesktop, @onResize())
Procedure onSendMessage()
Protected Buffer.s
Protected UserMessage.s = GetGadgetText(#mfMessage)
If UserMessage
Buffer = GetGadgetText(#mfHistory) + cr + UserMessage
SetGadgetText(#mfHistory, Buffer)
SetGadgetText(#mfMessage, "")
;Scroll vertical (Time out : 500
!$(v_selector.div).animate({scrollTop: $(v_selector.div).prop("scrollHeight")}, 500);
EndIf
EndProcedure
Procedure onResize()
Protected w = DesktopWidth(0)
Protected h = DesktopHeight(0)
ResizeGadget(#mfHistory, #PB_Ignore, #PB_Ignore, w , h - 100)
ResizeGadget(#mfMessage, #PB_Ignore, h - 70, w - 100, #PB_Ignore)
ResizeGadget(#mfSend, w - 95, h - 70, #PB_Ignore, #PB_Ignore)
EndProcedure
L'application n'étant pas signée tu es obligé de laisser le débogueur activé.
Astuce : Tu peux ne pas afficher la fenêtre de débogage dans l'application avec l'instruction CloseDebugOutput() en début de code.
Configuration : Windows 11 Famille 64-bit - PB 6.03 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
- microdevweb
- Messages : 1798
- Inscription : mer. 29/juin/2011 14:11
- Localisation : Belgique
Re: spiderbasic android
Merci falsam je vais tester ça.
Windows 10 64 bits PB: 5.70 ; 5.72 LST
Work at Centre Spatial de Liège
Work at Centre Spatial de Liège
- microdevweb
- Messages : 1798
- Inscription : mer. 29/juin/2011 14:11
- Localisation : Belgique
Re: spiderbasic android
Voila je viens de tester et il semblerais que cal fonctionne nickel.
Windows 10 64 bits PB: 5.70 ; 5.72 LST
Work at Centre Spatial de Liège
Work at Centre Spatial de Liège