Hello @Alls
Bug or no bug? That is the question.
I have an application that allows me to enter HTML/CSS/JavaScript code into a Scintilla gadget and see the result in a WebViewGadget().
I switch from code to result using the F5 key and vice versa from result to code using the Esc key.
Here is a minimal code snippet that reproduces this behavior.
Code: Select all
EnableExplicit
Enumeration window
#app
EndEnumeration
Enumeration gadgets
#editor
#webView
EndEnumeration
Enumeration menu
#viewCode
#viewResult
EndEnumeration
Declare scintillaCallBack(gadget, *scn.scNotification)
Declare viewCode()
Declare viewResult()
OpenWindow(#app, 0, 0, 800, 600, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
; ESC - Voir code
AddKeyboardShortcut(#app, #PB_Shortcut_Escape, #viewCode)
; F5 - Visualiser le résultat
AddKeyboardShortcut(#app, #PB_Shortcut_F5, #viewResult)
; Editeur Scintilla gadget associé à un callback
ScintillaGadget(#editor, 10, 10, 780, 580, @scintillaCallBack())
; Visualisation du résultat
WebViewGadget(#webView, 10, 10, 780, 580, #PB_WebView_Debug)
HideGadget(#webView, #True)
; Positionner le curseur de saisie dans l'éditeur
SetActiveGadget(#editor)
; Déclencheurs
BindEvent(#PB_Event_Menu, @viewCode(), #app, #viewCode)
BindEvent(#PB_Event_Menu, @viewResult(), #app, #viewResult)
; Boucle évenementielle
Repeat : Until WaitWindowEvent(1) = #PB_Event_CloseWindow
; Callback evenementielle du gadget scintilla
Procedure scintillaCallBack(gadget, *scn.scNotification)
; Analyser les evenement scintilla
Select *scn\nmhdr\code
Case #SCN_CHARADDED
Case #SCN_UPDATEUI
Case #SCN_MARGINCLICK
EndSelect
EndProcedure
; Basculement Code / Résultat
Procedure viewCode()
Debug "viewCode()"
HideGadget(#editor, #False)
HideGadget(#webView, #True)
SetActiveGadget(#editor)
EndProcedure
Procedure viewResult()
Debug "viewResult()"
HideGadget(#editor, #True)
HideGadget(#webView, #False)
EndProcedure

