PBFunctionListing.txt

Share your advanced PureBasic knowledge/code with the community.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4791
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

PBFunctionListing.txt

Post by Fangbeast »

Code updated For 5.20+

Every time PureBasic starts up, it creates a file called PBFunctionListing.txt that contains a list of all functions that PureBasic currently knows about which includes installed user libraries and the comments for each of those commands.

When a new version of PureBasic is released and there are no documents for it, that's where us inexperienced coders go to find out what commands PureBasic currently knows about that we might have missed. Now, this document is a little hard to read as it isn't formatted with proper CR/LF as it comes from the compiler, we need a simpler way of reading it.

1. To create a clean (PureBasic commands only) document, without user library commands,

a. Exit purebasic completely.
b. Temporarily move any libraries in the PureBasic\PureLibraries\UserLibraries folder to a safe place.
c. Restart PureBasic.
d. Exit purebasic completely.
e. Copy the PBFunctionListing.txt to a safe place.
f. Move your user libraries back to PureBasic\PureLibraries\UserLibraries

Now you have a listing of all the internal commands that PureBasic supports, along with their comments.

And if you find the document hard to read, either convert it (write code to do it yourself, a good way to learn!!) or use my viewer/searcher below if it's more convenient.

Code: Select all

Structure PBFileIndexList
  Function.s
  Comment.s
EndStructure

;============================================================================================================================
;
;============================================================================================================================

Global OldTitle.s = "View pb Functions and parameters", PBFileItemCount.l

NewList PBFl.PBFileIndexList()

;============================================================================================================================
;
;============================================================================================================================

Enumeration 1
  #Window_viewfunction
  #Window_functionbox
EndEnumeration

#WindowIndex = #PB_Compiler_EnumerationValue

Enumeration 1
  #Gadget_viewfunction_flist
  #Gadget_viewfunction_bgetlist
  #Gadget_viewfunction_bsavelist
  #Gadget_viewfunction_ssearch
  #Gadget_viewfunction_cfield
  #Gadget_functionbox_pbfunction
  #Gadget_functionbox_pbcomment
  #Shortcut_functionbox_escape
  #Shortcut_viewfunction_enter
EndEnumeration

#GadgetIndex = #PB_Compiler_EnumerationValue

;============================================================================================================================
;
;============================================================================================================================

Procedure.l Window_viewfunction()
  If OpenWindow(#Window_viewfunction,64,69,750,600,OldTitle,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible)
    
    ListIconGadget(#Gadget_viewfunction_flist,0,0,750,577,"Function",300,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
    AddGadgetColumn(#Gadget_viewfunction_flist,1,"Explanation",2000)
    ButtonGadget(#Gadget_viewfunction_bgetlist,0,580,60,20,"Get List")
    ButtonGadget(#Gadget_viewfunction_bsavelist,60,580,60,20,"Save list")
    StringGadget(#Gadget_viewfunction_ssearch,125,580,500,20,"")
    ComboBoxGadget(#Gadget_viewfunction_cfield,625,580,125,200)
    HideWindow(#Window_viewfunction,0)
    ProcedureReturn WindowID(#Window_viewfunction)
    ;         EndIf
  EndIf
EndProcedure

;============================================================================================================================
;
;============================================================================================================================

Procedure.l Window_functionbox()
  If OpenWindow(#Window_functionbox,162,228,500,180,"Show the function and its' description",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible,WindowID(#Window_viewfunction))
    
    StringGadget(#Gadget_functionbox_pbfunction,0,0,500,20,"")
    EditorGadget(#Gadget_functionbox_pbcomment,0,25,500,150)
    HideWindow(#Window_functionbox,0)
    ProcedureReturn WindowID(#Window_functionbox)
    ;         EndIf
  EndIf
EndProcedure

;============================================================================================================================
;
;============================================================================================================================

If Window_viewfunction()
  
  AddKeyboardShortcut(#Window_viewfunction, #PB_Shortcut_Return, #Shortcut_viewfunction_enter)
  
  QuitValue = 0
  
  AddGadgetItem(#Gadget_viewfunction_cfield, -1, "Function")
  AddGadgetItem(#Gadget_viewfunction_cfield, -1, "Comment")
  AddGadgetItem(#Gadget_viewfunction_cfield, -1, "Both")
  SetGadgetState(#Gadget_viewfunction_cfield, 2)
  
  Repeat
    
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Select EventWindow()
          Case #Window_viewfunction                   : QuitValue = 1
          Case #Window_functionbox                    : Gosub CloseFunctionBox
        EndSelect
      Case #PB_Event_Menu
        Select EventMenu()
          Case #Shortcut_viewfunction_enter           : Gosub StartFunctionSearch
          Case #Shortcut_functionbox_escape           : Gosub CloseFunctionBox
        EndSelect
      Case #PB_Event_Gadget
        Select EventGadget()
          Case #Gadget_viewfunction_flist
            Select EventType()
              Case #PB_EventType_LeftDoubleClick      : Gosub ShowFunctionBox
            EndSelect
          Case #Gadget_viewfunction_bgetlist          : Gosub GetFunctionList
          Case #Gadget_viewfunction_bsavelist         : Gosub SaveFunctionList
        EndSelect
        
    EndSelect
  Until QuitValue
  CloseWindow(#Window_viewfunction)
EndIf
End

;============================================================================================================================
GetFunctionList:
;============================================================================================================================

PBFileName.s = OpenFileRequester("Open PB Function Listing","PBFunctionListing.txt","Text (*.txt)|*.txt;*.asc;*.bat", 0)

If PBFileName.s <> ""
  PBFileID = ReadFile(#PB_Any, PBFileName.s)
  If PBFileID
    If ListSize(Pbfl.s()) <> 0
      ClearList(Pbfl.s())
    EndIf
    FileCounter = 0
    PBFileBuffer.s = ReadString(PBFileID, 0)
    SetWindowTitle(#Window_viewfunction, OldTitle + " - (" + PBFileBuffer + ") Functions found")
    While Eof(PBFileID) = 0
      PBFileBuffer.s       = ReadString(PBFileID, 0)            ; Read a string from the file
      PBFileBufferLength.l = Len(PBFileBuffer)
      PBFileSeparatorPos.l = FindString(PBFileBuffer, " - ", 1) ; Find the delimiter if any
      If PBFileSeparatorPos
        PBFileFunction.s     = Left(PBFileBuffer, PBFileSeparatorPos) ; Only need to go as far as the delimiter
        PBFileComment.s      = Mid(PBFileBuffer, PBFileSeparatorPos + 3, PBFileBufferLength - PBFileSeparatorPos)
        FileCounter + 1
        AddGadgetItem(#Gadget_viewfunction_flist, -1, PBFileFunction +  Chr(10) + PBFileComment)
        AddElement(Pbfl.s())
        Pbfl()\Function = PBFileFunction.s
        Pbfl()\Comment  = PBFileComment.s
        SendMessage_(GadgetID(#Gadget_viewfunction_flist), #LVM_ENSUREVISIBLE, FileCounter -1, 0) ; Make sure the current line is visible
      EndIf
    Wend
  EndIf
  CloseFile(PBFileID)
  PBFileItemCount = CountGadgetItems(#Gadget_viewfunction_flist)
EndIf

Return

;============================================================================================================================
SaveFunctionList:
;============================================================================================================================

PBFileName.s = SaveFileRequester("Open PB Function Listing","PBFunctionListing.New","Text (*.txt)|*.txt;*.asc;*.bat", 0)

If PBFileName.s <> ""
  PBFileID = CreateFile(#PB_Any, PBFileName.s)
  If PBFileID
    For PBFileItems.l = 0 To PBFileItemCount - 1
      PBFileFunction.s = GetGadgetItemText(#Gadget_viewfunction_flist, PBFileItems, 0)
      PBFileComment.s  = GetGadgetItemText(#Gadget_viewfunction_flist, PBFileItems, 1)
      WriteStringN(PBFileID, PBFileFunction + Chr(09) + PBFileComment)
    Next
  EndIf
  CloseFile(PBFileID)
EndIf

Return

;============================================================================================================================
StartFunctionSearch:
;============================================================================================================================

FocusID = GetFocus_()

Select FocusID
  Case GadgetID(#Gadget_viewfunction_ssearch)
    For PBFileItems.l = 0 To PBFileItemCount - 1
      SetGadgetItemColor(#Gadget_viewfunction_flist, PBFileItems, #PB_Gadget_BackColor,  $FFFFFF)
      SetGadgetItemColor(#Gadget_viewfunction_flist, PBFileItems, #PB_Gadget_FrontColor, $000000)
    Next
    PBFileSearch.s = LCase(GetGadgetText(#Gadget_viewfunction_ssearch))
    PBFileField.s  = GetGadgetText(#Gadget_viewfunction_cfield)
    For PBFileItems.l = 0 To PBFileItemCount - 1
      PBFileFunction.s = LCase(GetGadgetItemText(#Gadget_viewfunction_flist, PBFileItems, 0))
      PBFileComment.s  = LCase(GetGadgetItemText(#Gadget_viewfunction_flist, PBFileItems, 1))
      Select PBFileField
        Case "Both"
          PBFileStringToSearch.s = PBFileFunction + PBFileComment
        Case "Function"
          PBFileStringToSearch.s = PBFileFunction
        Case "Comment"
          PBFileStringToSearch.s = PBFileComment
      EndSelect
      If FindString(PBFileStringToSearch, PBFileSearch, 1) <> 0
        SendMessage_(GadgetID(#Gadget_viewfunction_flist), #LVM_ENSUREVISIBLE, PBFileItems, 0)
        SetGadgetItemColor(#Gadget_viewfunction_flist, PBFileItems, #PB_Gadget_BackColor,  2329400)
        SetGadgetItemColor(#Gadget_viewfunction_flist, PBFileItems, #PB_Gadget_FrontColor, $FFFFFF)
        SetActiveGadget(#Gadget_viewfunction_ssearch)
      EndIf
    Next
  Case GadgetID(#Gadget_viewfunction_flist)
    Gosub ShowFunctionBox
EndSelect

Return

;============================================================================================================================
ShowFunctionBox:
;============================================================================================================================

If Window_functionbox()
  AddKeyboardShortcut(#Window_functionbox, #PB_Shortcut_Escape, #Shortcut_functionbox_escape)
  SendMessage_(GadgetID(#Gadget_functionbox_pbcomment), #EM_SETTARGETDEVICE, #Null, 0) ; Set wordwrap in comment box
  PBFileLine.l = GetGadgetState(#Gadget_viewfunction_flist)
  If PBFileLine <> -1
    SetGadgetText(#Gadget_functionbox_pbfunction, GetGadgetItemText(#Gadget_viewfunction_flist, PBFileLine, 0))
    SetGadgetText(#Gadget_functionbox_pbcomment,  GetGadgetItemText(#Gadget_viewfunction_flist, PBFileLine, 1))
  EndIf
EndIf

Return

;============================================================================================================================
CloseFunctionBox:
;============================================================================================================================

CloseWindow(#Window_functionbox)
SetActiveGadget(#Gadget_viewfunction_flist)
SetGadgetItemState(#Gadget_viewfunction_flist, PBFileLine, #PB_ListIcon_Selected)

Return

**EDIT** Bugs fixed, smarter change from NetMaestro added as suggested, program tested. Extra bugs added (because I'm mean)!!
Last edited by Fangbeast on Thu Feb 09, 2006 11:14 am, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Very nice little tool! Thanks for this. Wait, that's too positive, isn't it? Ok, let's tone it down a bit:

Line 138 was causing the last character or two to be cut off the descriptions:
Code:
PBFileComment.s = Mid(PBFileBuffer, PBFileSeparatorPos + 3, PBFileBufferLength - (PBFileSeparatorPos + 3)

Works better like this:
Code:
PBFileComment.s = Mid(PBFileBuffer, PBFileSeparatorPos + 3, PBFileBufferLength - PBFileSeparatorPos)

-bloody nitpickers, eh?
Last edited by netmaestro on Tue Feb 21, 2006 3:00 pm, edited 2 times in total.
BERESHEIT
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

SaveFunctionList:
have 2 bugs, can't save anything

thx for sharing
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4791
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

netmaestro wrote:Very nice little tool! Thanks for this. Wait, that's too positive, isn't it? Ok, let's tone it down a bit:

Line 138 was causing the last character or two to be cut off the descriptions:

Code: Select all

PBFileComment.s = Mid(PBFileBuffer, PBFileSeparatorPos + 3, PBFileBufferLength - (PBFileSeparatorPos + 3)
Works better like this:

Code: Select all

PBFileComment.s = Mid(PBFileBuffer, PBFileSeparatorPos + 3, PBFileBufferLength - PBFileSeparatorPos)
-bloody nitpickers, eh?
Yes, pick the nits off, they make me itch anyway. ROFLMAO.

Thanks for the heads up, I'll fix it:):) (people who share learn more and I learn of all of you)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4791
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

ts-soft wrote:SaveFunctionList:
have 2 bugs, can't save anything

thx for sharing
No problems, thanks for the heads up. Will fix it after dinner:):)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4791
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

@Ts-Soft the two bugs are fixed. I tested again and it works here. Always tired and always making mistakes.

@Netmaestro You suggestion was put in and tested.

THe fixed code was overlaid on the example post above.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

thx
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post by josku_x »

Hi folks, I modified the code to work on 3.9x (I use it still, until a stable release of v4 comes out :wink: )

Code: Select all

Structure PBFileIndexList 
  Function.s 
  Comment.s 
EndStructure 

;============================================================================================================================ 
; 
;============================================================================================================================ 

Global OldTitle.s, PBFileItemCount.l 
OldTitle="View pb Functions And parameters"

NewList PBFl.PBFileIndexList() 

;============================================================================================================================ 
; 
;============================================================================================================================ 

Enumeration 1 
  #Window_viewfunction 
  #Window_functionbox 
EndEnumeration 

#WindowIndex = #PB_Compiler_EnumerationValue 

Enumeration 1 
  #Gadget_viewfunction_flist 
  #Gadget_viewfunction_bgetlist 
  #Gadget_viewfunction_bsavelist 
  #Gadget_viewfunction_ssearch 
  #Gadget_viewfunction_cfield 
  #Gadget_functionbox_pbfunction 
  #Gadget_functionbox_pbcomment 
  #Shortcut_functionbox_escape 
  #Shortcut_viewfunction_enter 
EndEnumeration 

#GadgetIndex = #PB_Compiler_EnumerationValue 

;============================================================================================================================ 
; 
;============================================================================================================================ 

Procedure.l Window_viewfunction() 
  If OpenWindow(#Window_viewfunction,64,69,750,600,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible,OldTitle) 
    If CreateGadgetList(WindowID(#Window_viewfunction)) 
      ListIconGadget(#Gadget_viewfunction_flist,0,0,750,577,"Function",300,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection) 
        AddGadgetColumn(#Gadget_viewfunction_flist,1,"Explanation",2000) 
      ButtonGadget(#Gadget_viewfunction_bgetlist,0,580,60,20,"Get List") 
      ButtonGadget(#Gadget_viewfunction_bsavelist,60,580,60,20,"Save list") 
      StringGadget(#Gadget_viewfunction_ssearch,125,580,500,20,"") 
      ComboBoxGadget(#Gadget_viewfunction_cfield,625,580,125,200) 
      HideWindow(#Window_viewfunction,0) 
      ProcedureReturn WindowID(#Window_viewfunction) 
    EndIf 
  EndIf 
EndProcedure 

;============================================================================================================================ 
; 
;============================================================================================================================ 

Procedure.l Window_functionbox() 
  If OpenWindow(#Window_functionbox,162,228,500,180,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible,"Show the function and its' description",WindowID(#Window_viewfunction)) 
    If CreateGadgetList(WindowID(#Window_functionbox)) 
      StringGadget(#Gadget_functionbox_pbfunction,0,0,500,20,"") 
      EditorGadget(#Gadget_functionbox_pbcomment,0,25,500,150) 
      HideWindow(#Window_functionbox,0) 
      ProcedureReturn WindowID(#Window_functionbox) 
    EndIf 
  EndIf 
EndProcedure 

;============================================================================================================================ 
; 
;============================================================================================================================ 

If Window_viewfunction() 

  AddKeyboardShortcut(#Window_viewfunction, #PB_Shortcut_Return, #Shortcut_viewfunction_enter) 
  
  QuitValue = 0 

  AddGadgetItem(#Gadget_viewfunction_cfield, -1, "Function") 
  AddGadgetItem(#Gadget_viewfunction_cfield, -1, "Comment") 
  AddGadgetItem(#Gadget_viewfunction_cfield, -1, "Both") 
  SetGadgetState(#Gadget_viewfunction_cfield, 2) 
  
  Repeat 

    Select WaitWindowEvent() 
      Case #PB_Event_CloseWindow 
        Select EventWindowID() 
          Case #Window_viewfunction                   : QuitValue = 1 
          Case #Window_functionbox                    : Gosub CloseFunctionBox 
        EndSelect 
      Case #PB_Event_Menu 
        Select EventMenuID() 
          Case #Shortcut_viewfunction_enter           : Gosub StartFunctionSearch 
          Case #Shortcut_functionbox_escape           : Gosub CloseFunctionBox 
        EndSelect 
      Case #PB_Event_Gadget 
        Select EventGadgetID() 
          Case #Gadget_viewfunction_flist 
            Select EventType() 
              Case #PB_EventType_LeftDoubleClick      : Gosub ShowFunctionBox 
            EndSelect 
          Case #Gadget_viewfunction_bgetlist          : Gosub GetFunctionList 
          Case #Gadget_viewfunction_bsavelist         : Gosub SaveFunctionList 
        EndSelect 

    EndSelect 
  Until QuitValue 
  CloseWindow(#Window_viewfunction) 
EndIf 
End 

;============================================================================================================================ 
GetFunctionList: 
;============================================================================================================================ 

  PBFileName.s = OpenFileRequester("Open PB Function Listing","PBFunctionListing.txt","Text (*.txt)|*.txt;*.asc;*.bat", 0) 
  
  If PBFileName.s <> "" 
    PBFileID = ReadFile(#PB_Any, PBFileName.s) 
    If PBFileID 
      If CountList(Pbfl.s()) <> 0 
        ClearList(Pbfl.s()) 
      EndIf 
      FileCounter = 0 
      PBFileBuffer.s = ReadString() 
      SetWindowTitle(#Window_viewfunction, OldTitle + " - (" + PBFileBuffer + ") Functions found") 
      While Eof(PBFileID) = 0 
        PBFileBuffer.s       = ReadString()            ; Read a string from the file 
        PBFileBufferLength.l = Len(PBFileBuffer) 
        PBFileSeparatorPos.l = FindString(PBFileBuffer, " - ", 1) ; Find the delimiter if any 
        If PBFileSeparatorPos 
          PBFileFunction.s     = Left(PBFileBuffer, PBFileSeparatorPos) ; Only need to go as far as the delimiter 
          PBFileComment.s      = Mid(PBFileBuffer, PBFileSeparatorPos + 3, PBFileBufferLength - PBFileSeparatorPos) 
          FileCounter + 1 
          AddGadgetItem(#Gadget_viewfunction_flist, -1, PBFileFunction +  Chr(10) + PBFileComment) 
          AddElement(Pbfl.s()) 
          Pbfl()\Function = PBFileFunction.s 
          Pbfl()\Comment  = PBFileComment.s 
          SendMessage_(GadgetID(#Gadget_viewfunction_flist), #LVM_ENSUREVISIBLE, FileCounter -1, 0) ; Make sure the current line is visible 
        EndIf 
      Wend 
    EndIf 
    CloseFile(PBFileID) 
    PBFileItemCount = CountGadgetItems(#Gadget_viewfunction_flist) 
  EndIf 
  
Return 

;============================================================================================================================ 
SaveFunctionList: 
;============================================================================================================================ 

  PBFileName.s = SaveFileRequester("Open PB Function Listing","PBFunctionListing.New","Text (*.txt)|*.txt;*.asc;*.bat", 0) 

  If PBFileName.s <> "" 
    PBFileID = CreateFile(#PB_Any, PBFileName.s) 
    If PBFileID 
      For PBFileItems.l = 0 To PBFileItemCount - 1 
        PBFileFunction.s = GetGadgetItemText(#Gadget_viewfunction_flist, PBFileItems, 0) 
        PBFileComment.s  = GetGadgetItemText(#Gadget_viewfunction_flist, PBFileItems, 1) 
        WriteStringN(PBFileFunction + Chr(09) + PBFileComment) 
      Next 
    EndIf 
    CloseFile(PBFileID) 
  EndIf 
  
Return 

;============================================================================================================================ 
StartFunctionSearch: 
;============================================================================================================================ 

  FocusID = GetFocus_() 
  
    Select FocusID 
      Case GadgetID(#Gadget_viewfunction_ssearch) 
        PBFileSearch.s = LCase(GetGadgetText(#Gadget_viewfunction_ssearch)) 
        PBFileField.s  = GetGadgetText(#Gadget_viewfunction_cfield) 
        For PBFileItems.l = 0 To PBFileItemCount - 1 
          PBFileFunction.s = LCase(GetGadgetItemText(#Gadget_viewfunction_flist, PBFileItems, 0)) 
          PBFileComment.s  = LCase(GetGadgetItemText(#Gadget_viewfunction_flist, PBFileItems, 1)) 
          Select PBFileField 
            Case "Both" 
              PBFileStringToSearch.s = PBFileFunction + PBFileComment 
            Case "Function" 
              PBFileStringToSearch.s = PBFileFunction 
            Case "Comment" 
              PBFileStringToSearch.s = PBFileComment 
          EndSelect 
          If FindString(PBFileStringToSearch, PBFileSearch, 1) <> 0 
            SendMessage_(GadgetID(#Gadget_viewfunction_flist), #LVM_ENSUREVISIBLE, PBFileItems, 0) 
            ActivateGadget(#Gadget_viewfunction_ssearch) 
          EndIf 
        Next 
      Case GadgetID(#Gadget_viewfunction_flist) 
        Gosub ShowFunctionBox 
    EndSelect 
    
Return 

;============================================================================================================================ 
ShowFunctionBox: 
;============================================================================================================================ 
      
  If Window_functionbox() 
    AddKeyboardShortcut(#Window_functionbox, #PB_Shortcut_Escape, #Shortcut_functionbox_escape) 
    SendMessage_(GadgetID(#Gadget_functionbox_pbcomment), #EM_SETTARGETDEVICE, #Null, 0) ; Set wordwrap in comment box 
    PBFileLine.l = GetGadgetState(#Gadget_viewfunction_flist) 
    If PBFileLine <> -1 
      SetGadgetText(#Gadget_functionbox_pbfunction, GetGadgetItemText(#Gadget_viewfunction_flist, PBFileLine, 0)) 
      SetGadgetText(#Gadget_functionbox_pbcomment,  GetGadgetItemText(#Gadget_viewfunction_flist, PBFileLine, 1)) 
    EndIf 
  EndIf 

Return 

;============================================================================================================================ 
CloseFunctionBox: 
;============================================================================================================================ 

  CloseWindow(#Window_functionbox) 
  ActivateGadget(#Gadget_viewfunction_flist) 
  SetGadgetItemState(#Gadget_viewfunction_flist, PBFileLine, #PB_ListIcon_Selected) 

Return 
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

Thanks for sharing!

How about for #PB_[CONSTANTS]?

*and I hope a book for PB 4 will be forthcoming by one of you gurus!*
Intrigued - Registered PureBasic, lifetime updates user
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post by josku_x »

Intrigued, I am not sure but I think there is already a #PB Constant viewer somewhere.. I'll check out in PureArea... :arrow: A book of PB 4? no, I mean we're just coders, not book makers 8)
Post Reply