It is currently Sun Nov 18, 2018 5:39 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: ScintillaGadget EventTypes
PostPosted: Wed Aug 15, 2018 4:15 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Dec 29, 2011 5:03 pm
Posts: 295
Could we have the following EventTypes for the ScintillaGadget, please?
Code:
#PB_EventType_Change
#PB_EventType_Focus
#PB_EventType_LostFocus


Top
 Profile  
Reply with quote  
 Post subject: Re: ScintillaGadget EventTypes
PostPosted: Wed Aug 15, 2018 8:54 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1444
Location: Germany
You can use ScintillaCallback...
Code:
;-TOP

Procedure ScintillaCallBack(Gadget, *scinotify.SCNotification)
  Select *scinotify\nmhdr\code
    Case #SCN_MODIFIED
      ;Debug *scinotify\modificationType
      CompilerSelect #PB_Compiler_OS
        CompilerCase #PB_OS_Windows
          ; Always ready
        CompilerCase #PB_OS_MacOS
          If *scinotify\modificationType & #SC_MOD_BEFOREINSERT
            PostEvent(#PB_Event_Gadget, GetActiveWindow(), Gadget, #PB_EventType_Change)
          ElseIf *scinotify\modificationType & #SC_MOD_BEFOREDELETE
            PostEvent(#PB_Event_Gadget, GetActiveWindow(), Gadget, #PB_EventType_Change)
          EndIf
         
        CompilerCase #PB_OS_Linux
          If *scinotify\modificationType & #SC_MOD_BEFOREINSERT
            PostEvent(#PB_Event_Gadget, GetActiveWindow(), Gadget, #PB_EventType_Change)
          ElseIf *scinotify\modificationType & #SC_MOD_BEFOREDELETE
            PostEvent(#PB_Event_Gadget, GetActiveWindow(), Gadget, #PB_EventType_Change)
          EndIf
         
      CompilerEndSelect
     
    Case #SCN_FOCUSIN
      PostEvent(#PB_Event_Gadget, GetActiveWindow(), Gadget, #PB_EventType_Focus)
     
    Case #SCN_FOCUSOUT
      PostEvent(#PB_Event_Gadget, GetActiveWindow(), Gadget, #PB_EventType_LostFocus)
     
  EndSelect
 
EndProcedure

If OpenWindow(0, 0, 0, 330, 90, "ScintillaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 
  If InitScintilla()
    ScintillaGadget(0, 10, 10, 320, 70, @ScintillaCallBack())
   
    ; Ausgabe auf rote Farbe setzen
    ScintillaSendMessage(0, #SCI_STYLESETFORE, 0, RGB(255, 0, 0))
   
    ; Anfänglichen Text des ScintillaGadgets festlegen
    ScintillaSendMessage(0, #SCI_SETTEXT, 0, UTF8("This is a simple ScintillaGadget with text..."))
   
    ; Hinzufügen einer zweiten Zeile mit einem vorherigen Zeilenumbruch
    Text$ = Chr(10) + "Second line"
    ScintillaSendMessage(0, #SCI_APPENDTEXT, Len(Text$), UTF8(Text$))
  EndIf
 
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Break
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 0
            Select EventType()
              Case #PB_EventType_Focus
                Debug "Focus"
              Case #PB_EventType_LostFocus
                Debug "LostFocus"
              Case #PB_EventType_Change
                Debug "Change"
             
            EndSelect
           
        EndSelect
       
    EndSelect
  ForEver
EndIf

_________________
My Projects OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer /
PB v3.30 / v5.60 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Last edited by mk-soft on Wed Aug 15, 2018 9:46 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: ScintillaGadget EventTypes
PostPosted: Wed Aug 15, 2018 9:46 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Dec 29, 2011 5:03 pm
Posts: 295
I forgot about the callback. Thanks. However, the ScintillaGadget in the Dialog library doesn't support assigning a callback.

I wonder if I could add a ScintillaGadget to a dialog after the dialog has been created. Hmm.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye