PBOSL - A OpenSource Library-Collection for PureBasic

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

Not sure if this has been reported before - a fairly trivial issue with an example, namely PBOSL_EXAMPLES\PBOSL4\EXAMPLES\PBOSL_SkinWin\BackColor\BackColor.pb

On my machine, I've noticed that a runtime error occurs. In the Timer() procedure, the SetWinBackgroundColor(WindowID(0), RGB(a,a,$FF)) bombs out because it is called before the window has a chance to open. The solution is to change the timing in StartTimer(1,10,@Timer()) from 10 milliseconds to something much longer.

I mention it just for completeness. Thanks for making this lib available.
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 for report, fixed and uploaded
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
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

If you have problems with the RaGrid Example from CreateGadget, replace the user32.lib in pb or import this one: http://ts-soft.eu/dl/user32.zip
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
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

DBin from DoubleDutch added, thx
Help for DBin and CreateGadget added
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
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Update:
DBin fixed. Full Unicode Support!
In the moment no optional parameters, sry.

Process lib in the moment buggy, sry
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
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

DBin_Packer.exe added to examples
You can also download here

Image
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
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Very nice. :D
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
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 »

Update for win-binarys only (source and cvs update coming soon...)

Added:
ScreenGadgets by Dostej (completely rewritten for PB4)

Extra:
Threadsafe Librarys:
PBOSL_ExPrinter
PBOSL_MSXML3
PBOSL_NTService
PBOSL_Process
PBOSL_RFile
PBOSL_SQLite3

Use Subsytem "UserLibThreadSafe"

some other small corrections

Regards
Thomas
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
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Example for ScreenGadgets:

Code: Select all

Enumeration
  #Button_0
  #String_0
  #Text_0
  #ScrollBar_0
  #ScrollBar_1
  #CheckBox_0
  #CheckBox_1
  #ListIcon_0
  #ListIcon_1
  #ListIcon_2
  #ListIcon_3
  #Radio_0
  #Radio_1
  #Radio_2
  #TrackBar_0
  #TrackBar_1
  #Frame3D_0
  #Frame3D_1
  #Frame3D_2
  #Frame3D_3 
  #ImageButton_0
  #Image_0
EndEnumeration


Procedure.f FpS2() 
  Static Start_Zeit, Frames, SendFrames.f 
  Zeit_akt = ElapsedMilliseconds()
  Frames + 1 
  ZeitU = Zeit_akt - Start_Zeit 
  If ZeitU 
    SendFrames = Frames / ZeitU 
  EndIf  
  If Zeit_akt >= Start_Zeit + 10000 
    Start_Zeit = Zeit_akt 
    Frames = 0 
  EndIf 
  ProcedureReturn SendFrames * 1000 
EndProcedure

If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse()= 0
  MessageRequester("Fehler", "init") 
  End 
EndIf

If OpenWindow(1, 0, 0, 1024, 768, "", #PB_Window_BorderLess)
  If OpenWindowedScreen(WindowID(1), 0,0, 1024, 768, 0, 0, 0)
    ; create a mouse
    If CreateSprite(0, 8, 8) 
      If StartDrawing(SpriteOutput(0)) 
        Circle(4, 4, 4, RGB(255, 255, 255)) 
        StopDrawing()
      EndIf 
    EndIf
    
    ;{ build Screengadgets
    ; set the standard appearance for the gadgets to build
    CreateSprite(2, 1024, 768)
    StartDrawing(SpriteOutput(2))
    Box(0, 0, 1024, 768, $0080FF)
    DrawingMode(4)
    For x = 0 To 200
      Circle(Random(900) + 50, Random(668) + 50, Random(40) + 10, RGB(Random(255), Random(255), Random(255)))
    Next
    StopDrawing()
    
    CreateImage(11, 100, 60)
    StartDrawing(ImageOutput(11))
    Box(0, 0, 100, 60, $00FFFF)
    DrawingMode(4)
    For x = 0 To 200
      Circle(Random(90) + 5, Random(50) + 5, Random(4) + 1, RGB(Random(255), Random(255), Random(255)))
    Next
    StopDrawing()
    
    
    If 0 ; show the gadgets with an image background; play with this to see the framerate drop if the image is too large
      #Imagesize = 50
      CreateImage(1, #Imagesize, #Imagesize)
      StartDrawing(ImageOutput(1))
      Box(0, 0, #Imagesize, #Imagesize, $0080FF)
      DrawingMode(4)
      For x = 0 To #Imagesize>>1
        Circle(Random(#Imagesize-10) + 10, Random(#Imagesize-10) + 10, Random(#Imagesize-10) + 10, RGB(Random(255), Random(255), Random(255)))
      Next
      StopDrawing()
      SG_SetBackground(2)
      SG_SetBackgroundImage(ImageID(1))
      SG_SetColor($00FFFF) 
    Else ; show the gadgets transparent
      SG_SetBackground(0)
      SG_SetColor($00FFFF)
    EndIf
    testfont = LoadFont(5, "Albany", 20)
    s.s
    ; 
    ; berechne die Objekte
    s = #CRLF$ + "teststring1" + ": " +  #CRLF$
    s = s + "teststring2" + ": " +  #CRLF$ + #CRLF$
    s = s + "teststring3" + ": " + #CRLF$ + #CRLF$
    s = s + "teststring4" + ": " + " %" + #CRLF$
    s = s + "teststring5" + #CRLF$
    s = s + "teststring6" + #CRLF$
    s = s + "teststring7" + #CRLF$
    
    ;
    SG_EditorGadget(#String_0, 40, 180, 230, 90)
    SG_SetGadgetText(#String_0, s)
    SG_SetGadgetBackground(#String_0, 0)
    SG_SetGadgetColor(#String_0, $FFFFFF)
    SG_AddGadgetItem(#String_0, -1, "Test 1. item")
    SG_SetGadgetItemFont(#String_0, 2, 5)
    SG_SetGadgetItemColor(#String_0, 2, $0000FF, $FF0000)
    
    SG_StringGadget(#Text_0, 40, 40, 240, 40, "Textgadget eingabetext", #PB_Text_Border | #PB_Text_Center)
    
    SG_CheckBoxGadget(#CheckBox_0, 40, 340, 240, 20, "CB 0")
    
    SG_ScrollBarGadget(#ScrollBar_0, 400, 10, 220, 20, 0, 100, 10)
    SG_ScrollBarGadget(#ScrollBar_1, 750, 80, 20, 220, 0, 100, 10, #PB_ScrollBar_Vertical)
    SG_OptionGadget(#Radio_0, 40, 410, 280, 20, "RD 0")
    SG_OptionGadget(#Radio_1, 40, 430, 280, 20, "RD 1")
    SG_CheckBoxGadget(#CheckBox_1, 40, 360, 240, 20, "CB 1")
    SG_OptionGadget(#Radio_2, 340, 450, 280, 20, "RD 2")
    SG_OptionGadget(40, 340, 470, 280, 20, "RD 2")
    
    
    SG_ListIconGadget(#ListIcon_0, 430, 80, 250, 315, "Column0", 100, #PB_ListIcon_AlwaysShowSelection | #PB_ListIcon_GridLines) ; 
    SG_AddGadgetColumn(#ListIcon_0, 1, "Column1", 100)
    For x = 1 To 80 
      SG_AddGadgetItem(#ListIcon_0, -1, "test " + Str(x) + Chr(10) + "teil 2 / " + Str(x))
    Next
    
    SG_SetGadgetItemState(#ListIcon_0, 11, 1)
    
    SG_SetGadgetItemColor(#ListIcon_0, 0, $FF0000, -1)
    SG_SetGadgetItemColor(#ListIcon_0, 1, $00FF00, -1)
    
    CreateImage(201, 16, 16)
    StartDrawing(ImageOutput(201))
    Box(0, 0, 16, 16, $FF00FF)
    StopDrawing()
    SG_AddGadgetItem(#ListIcon_0, 5, "test 5neu", ImageID(201))
    
    CreateImage(200, 16, 16)
    StartDrawing(ImageOutput(200))
    Box(0, 0, 16, 16, $0000FF)
    StopDrawing()
    SG_AddGadgetItem(#ListIcon_0, 8, "test 8 neu", ImageID(200))
    
    
    SG_SetGadgetBackground(#ListIcon_0, 0)
    SG_SetGadgetColor(#ListIcon_0, $00FFFF)
    
    SG_ListIconGadget(#ListIcon_1, 900, 80, 100, 100, "Column0", 100, #PB_ListIcon_GridLines)
    SG_ListIconGadget(#ListIcon_3, 100, 80, 100, 95, "Column0", 100, #PB_ListIcon_GridLines)
    For x = 1 To 50 ; max number of entries for a Listicongadget
      SG_AddGadgetItem(#ListIcon_3, -1, "test " + Str(x))
    Next
    
    SG_ListIconGadget(#ListIcon_2, 700, 380, 100, 90, "Column0", 100, #PB_ListIcon_GridLines)
    
    SG_TrackBarGadget(#TrackBar_0, 40, 550, 250, 30, 0, 100, #PB_TrackBar_Ticks)
    
    
    SG_TrackBarGadget(#TrackBar_1, 800, 50, 250, 30, 0, 4, #PB_TrackBar_Vertical | #PB_TrackBar_Ticks)
    SG_ButtonGadget(#Button_0, 650, 660, 120, 40, "OK")
    SG_SetGadgetColor(#Button_0, $FFFFFF)
    SG_SetGadgetBackground(#Button_0, 0)
    
    SG_SetColor($FFFFFF)
    SG_Frame3DGadget(#Frame3D_0, 300, 510, 80, 20, "TEst 1")
    SG_Frame3DGadget(#Frame3D_1, 400, 510, 80, 20, "TEst 2", #PB_Frame3D_Double)
    SG_Frame3DGadget(#Frame3D_2, 500, 510, 80, 20, "TEst 3", #PB_Frame3D_Single)
    SG_Frame3DGadget(#Frame3D_3, 600, 510, 80, 20, "TEst 4", #PB_Frame3D_Flat)
    
    SG_ImageGadget(#Image_0, 300, 550, 100, 60, ImageID(11), 0)
    SG_ButtonImageGadget(#ImageButton_0, 450, 550, 100, 60, ImageID(11), 0)
    ;} 
    
    SG_SetGadgetState(#TrackBar_1, 4)
    
    ;{ Eventloop
    Repeat ; Start of the event loop
      ClearScreen(0)
      ; DisplaySprite(2, 0, 0) ; play with this for a background to see the "transparence" of the gadgets
      ; 
      StartDrawing(ScreenOutput())
      
      DrawText(20, 20,StrF(FpS2()))
      StopDrawing()
      
      SG_DrawAllGadgets()
      ExamineMouse () 
      DisplayTransparentSprite(0, MouseX(), MouseY())
      
      FlipBuffers()
      
      ;{ standard loop
      Event = SG_ScreenGadgetEvent() ; This line checks if an event happened
      
      GadgetID = SG_EventScreenGadgetID() ; Is it a gadget event?
      
      EventType = SG_EventType() ; The event type
      
      If Event = #PB_Event_Gadget
        
        If GadgetID = #Button_0
          If EventType = #SG_EventType_LeftRelease
            SG_FreeAllGadgets()
            Event = #PB_Event_CloseWindow
          EndIf
          
        ElseIf GadgetID = #String_0
          If EventType = #SG_EventType_LeftClick
            SG_SetGadgetText(#String_0, "Zeile1" + #CRLF$ + "Zeile2" + #CRLF$ + "Zeile3" + #CRLF$ + "Zeile4")
          EndIf
          
        ElseIf GadgetID = #Text_0
          If EventType = #SG_EventType_LeftClick
            SG_SetGadgetText(#Text_0, "New text")
          ElseIf EventType = #SG_EventType_RightClick
            SG_SetGadgetText(#Text_0, "On the right")
          ElseIf EventType = #SG_EventType_Wheel
            SG_SetGadgetText(#Text_0, Str(SG_MouseWheel_GL))
          EndIf
          
        ElseIf GadgetID = #CheckBox_0
          
        ElseIf GadgetID = #CheckBox_1
          
        ElseIf GadgetID = #ImageButton_0
          If EventType = #SG_EventType_LeftRelease
            SG_ClearGadgetItemList(#ListIcon_0)
            For x = 1 To 400 ; max number of entries for a Listicongadget
              SG_AddGadgetItem(#ListIcon_0, -1, "test " + Str(x) + Chr(10) + "teil 2 / " + Str(x))
            Next
            
            SG_ShowListItem(#ListIcon_0, 25)
            SG_SetGadgetState(#TrackBar_0, 50)
          EndIf
          SG_SetGadgetState(#ScrollBar_1, 50)
          
        ElseIf GadgetID = #Radio_0
          
        ElseIf GadgetID = #Radio_1
          
        ElseIf GadgetID = #TrackBar_0
          SG_SetGadgetText(#String_0, "TrackBar 0: " + Str(SG_GetGadgetState(#TrackBar_0)))
          
        ElseIf GadgetID = #TrackBar_1
          SG_SetGadgetText(#String_0, "TrackBar 2: " + Str(SG_GetGadgetState(#TrackBar_1)))
          
        ElseIf GadgetID = #ListIcon_0
          If EventType = #SG_EventType_LeftRelease
            ; debug " "
            ; debug "element: " + Str(SG_GetGadgetState(#ListIcon_0))
            ; debug "inhalt: " + SG_GetGadgetItemText(#ListIcon_0, SG_GetGadgetState(#ListIcon_0))
            ; debug "inhalt: " + SG_GetGadgetItemText2(#ListIcon_0, SG_GetGadgetState(#ListIcon_0), 1)
          EndIf
          
        ElseIf GadgetID = #ListIcon_1
          If EventType = #SG_EventType_LeftRelease
            SG_ClearGadgetItemList(#ListIcon_0)
            For x = 1 To 70 
              SG_AddGadgetItem(#ListIcon_0, -1, "test " + Str(x) + Chr(10) + "teil 2 / " + Str(x))
            Next
          EndIf
          
        ElseIf GadgetID = #ScrollBar_0
          SG_SetGadgetText(#String_0, "Scrollbar 1: " + Str(SG_GetGadgetState(#ScrollBar_0)) + #CRLF$ + "Scrollbar 2: " + Str(SG_GetGadgetState(#ScrollBar_1)))
          
        ElseIf GadgetID = #ScrollBar_1
          SG_SetGadgetText(#String_0, "Scrollbar 1: " + Str(SG_GetGadgetState(#ScrollBar_0)) + #CRLF$ + "Scrollbar 2: " + Str(SG_GetGadgetState(#ScrollBar_1)))
          
        EndIf
        
      EndIf
      ;}
      Delay(1)
      
      ExamineMouse()
      
    Until Event = #PB_Event_CloseWindow Or MouseButton(2) ; End of the event loop
    
    ;}
  EndIf
EndIf
;}


End
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
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

SubSystem UserLibThreadSafe

added:
PBOSL_ScreenGadgets

SubSystem UserLibUnicode

added:
PBOSL_RFile
PBOSL_ScreenGadgets
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
FreeThought
User
User
Posts: 54
Joined: Mon Jul 18, 2005 10:28 am

Thanks for update

Post by FreeThought »

Hi,is it possible to please include in your next release Ppeekc. Thanks.
Regards.
Ft.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Thanks for update

Post by ts-soft »

FreeThought wrote:Hi,is it possible to please include in your next release Ppeekc. Thanks.
Regards.
Ft.
sry, I do not understand
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
FreeThought
User
User
Posts: 54
Joined: Mon Jul 18, 2005 10:28 am

Post by FreeThought »

Thanks ts-soft , since there are pPeekb,pPeekw,...,it is nice if we can have pPeekc.
Regards.
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Followed directions, the Sqlite3 module is broken. Nothing but memory errors on every single command used. And yes, the dll is in the correct directory.

Any fixed versions around?
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 »

Shannara wrote:Followed directions, the Sqlite3 module is broken. Nothing but memory errors on every single command used. And yes, the dll is in the correct directory.

Any fixed versions around?
I have test it with all examples from pbosl, all works fine for me

UNICODE isn't supported!
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
Post Reply