Scintilla Gadget Question on refresh process...

Just starting out? Need help? Post your questions and find answers here.
mocitymm
User
User
Posts: 37
Joined: Wed Feb 08, 2017 6:56 pm

Scintilla Gadget Question on refresh process...

Post by mocitymm »

Hopefully I can explain this sufficiently.

I am using the Scintilla gadget to load a log file that is constantly being updated by a service in the background, the log is loaded via a button gadget - there is also a 'refresh' button gadget on the form.

The log loads just fine and the refresh procedure is working but, for visual or 'aesthetics' purposes only if you will I would like to have the Scintilla gadget to show a blank interface just prior to the refresh of the log.

I am not finding the key word setting I am looking for... new territory for me with Scintilla. If anyone can point me in the right direction it would be greatly appreciated.

Regards,

-Mo
User avatar
mk-soft
Always Here
Always Here
Posts: 6412
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Scintilla Gadget Question on refresh process...

Post by mk-soft »

Hide gadget over time ...

Update because #PB_Any

Code: Select all

;-TOP

Global NewMap GadgetTimer()

Procedure HideGadgetTime(Window, Gadget, Time)
  Protected Timer = GadgetID(Gadget)
  If Not FindMapElement(GadgetTimer(), Str(Timer))
    AddMapElement(GadgetTimer(), Str(Timer))
    GadgetTimer() = Gadget
    HideGadget(Gadget, 1)
    AddWindowTimer(Window, Timer, Time)
  EndIf
EndProcedure

Procedure ShowGadgetTime()
  Protected Timer = EventTimer()
  If FindMapElement(GadgetTimer(), Str(Timer))
    RemoveWindowTimer(EventWindow(), Timer)
    If IsGadget(GadgetTimer())
      HideGadget(GadgetTimer(), 0)
    EndIf
    DeleteMapElement(GadgetTimer())
  EndIf
EndProcedure

BindEvent(#PB_Event_Timer,@ShowGadgetTime())

If OpenWindow(0, 0, 0, 330, 90, "ScintillaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
  If InitScintilla()
    ScintillaGadget(0, 10, 10, 320, 70, 0)
    
    ; Ausgabe auf rote Farbe setzen
    ScintillaSendMessage(0, #SCI_STYLESETFORE, 0, RGB(255, 0, 0))
    
    ; Anfänglichen Text des ScintillaGadgets festlegen
    *Text = UTF8("This is a simple ScintillaGadget with text...")
    ScintillaSendMessage(0, #SCI_SETTEXT, 0, *Text)
    FreeMemory(*Text)  ; Der von UTF8() erstellte Puffer muss freigegeben werden, um ein Speicherleck zu vermeiden
    
    ; Hinzufügen einer zweiten Zeile mit einem vorherigen Zeilenumbruch
    Text$ = Chr(10) + "Second line"
    *Text = UTF8(Text$)
    ScintillaSendMessage(0, #SCI_APPENDTEXT, Len(Text$), *Text)
    FreeMemory(*Text)
  EndIf
  
  HideGadgetTime(0, 0, 2000)
  
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
mocitymm
User
User
Posts: 37
Joined: Wed Feb 08, 2017 6:56 pm

Re: Scintilla Gadget Question on refresh process...

Post by mocitymm »

mk-soft,

Thank you. Interesting code, I will attempt to make it work for me. I've used the 'CLEARALL' on the example code from the help in the IDE, that works with the example code and does what I am looking for... just doesn't work in my code. So my assumption at this point is a logic flaw in my code somewhere or I don't know what I am doing... *Not the first or last time that is going to happen*

Regards,
-Mo
Post Reply