It is currently Wed May 22, 2013 3:34 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: OPB v0.51 (objective PB)
PostPosted: Tue Nov 08, 2011 8:12 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Apr 04, 2006 6:27 am
Posts: 308
fsw wrote:
Surely interesting stuff.
Because it's low level asm it's tight to 32bit OS.
Had to install PB32 in order to try it out...

Still very nice.


Wait ... this is limited to 32bit PB?


Top
 Profile  
 
 Post subject: Re: OPB v0.53 (objective PB)
PostPosted: Tue Nov 08, 2011 8:21 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 2485
Location: New Zealand
It was but it's fixed now, should be fine for 64bit but I can't test it


Top
 Profile  
 
 Post subject: Re: OPB v0.53 (objective PB)
PostPosted: Thu Nov 10, 2011 12:31 am 
Offline
Addict
Addict
User avatar

Joined: Tue Apr 29, 2003 9:18 pm
Posts: 1115
Location: North by Northwest
Yes it works on Win7-64 (not tested on Linux-64...)


Top
 Profile  
 
 Post subject: Re: OPB v0.53 (objective PB)
PostPosted: Tue Nov 29, 2011 8:33 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Apr 29, 2003 9:18 pm
Posts: 1115
Location: North by Northwest
Hello,
just wanted to mention that I had time over the weekend and looked at the misbehaving event loop.

Here the fix:

Code:
; this is inside the event loop...
; some code and then:
;...
        If EventGadget 
         
          ForEach *win\gadget() 
            *gad = *win\gadget()
         
            If *gad\gadget = EventGadget
              GadgetFound = #True                                          <- added this
              Break
            EndIf 
           
          Next
         
          If GadgetFound                                                       <- added this
           
            Select EventType
               
              Case #PB_EventType_LeftClick

; and then do:

          ; reset GadgetFound = prep for new event...
          GadgetFound = #False                                           <- added this
         
        Else
          ClassWindowCheckHits(*win)
        EndIf

; and so on...



that's all.

Even created a small SQLite app with an extended cWindow (changed some stuff for less typing) - it was a breeze.

What I like about this approach is that it can live alongside "normal" PB commands/syntax.

Will soon post my cWindow extensions when I'm done.

Thanks
fsw


Top
 Profile  
 
 Post subject: Re: OPB v0.53 (objective PB)
PostPosted: Tue Nov 29, 2011 9:43 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 2485
Location: New Zealand
Thanks I'll fix up the example.


Top
 Profile  
 
 Post subject: Re: OPB v0.54 (objective PB)
PostPosted: Sun Dec 11, 2011 10:58 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 2485
Location: New Zealand
updated it

changed it so OPB can also be used as a shared object or statically compiled with a class
and extended the window manager example so it can be used as a shared object also to test modularity

see the Readme in the zip


Top
 Profile  
 
 Post subject: Re: OPB v0.54 (objective PB)
PostPosted: Fri Dec 16, 2011 2:14 am 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 2485
Location: New Zealand
Extended the event driven window manager to handle a windowed screen with multiple control windows
isn't complete yet or extensively debugged and not sure if #PB_Event_DeactivateWindow is present on windows

Events are registered with a precedence
1 a specific gadget and event "OnClick" ...
2 a specific gadget or any gadget and all its events via "Onevent"
1 a specific window and event "OnWindowMaximize"
2 a specific window or any window and all its gadgets events via "OnEvent"
1 a WindowScreen callback for rendering

keyboard functions replace PB keyboard (*don't use pb InitKeyboard)
US english keyboard is currently text mapped scan includes lowercase keys

ClassWindowKeyboardPressed(windowObject,#OPBKey_UP) to test for multiple key presses
ClassWindowKeyboardReleased(windowObject,#OPBKey_DOWN)
key = ClassWindowGetKey(windowobject) ;gets the current key pressed down
keyString = ClassWindowGetKeyString(key) ;converts the key to it's string (needs to be language mapped)

[edit]
Added MouseScroll events
Fixed a few bugs

Code:
Procedure Window2_OK_OnClick()
;...
Endprocedure

w2 = NewWindow("w2",0,0,300,200,"Window2",#PB_Window_ScreenCentered)
wn2 = ClassWindowGetWindowNumber(w2)
 
If CreateMenu(0,ClassWindowGetWindowID(w2))
  MenuTitle("Project")
  MenuItem(1, "Open")
  MenuBar()                 
  MenuItem(4, "Close")
EndIf

;register menu callback
ClassWindowRegisterWindowEvent(w2,#OnMenu,@Window2_OnMenu())
;Add a gadget and register a event pass in the gadget ID   
b2 = ClassWindowAddGadget(w2,ButtonGadget(#PB_Any,235,5,60,20,"OK"), #OnClick,@Window2_OK_OnClick())
;add additional events for the gadget mouse enter / leave 
ClassWindowRegisterGadgetEvent(b2,#OnMouseEnter,@Window2_OK_OnMouseEnter())
ClassWindowRegisterGadgetEvent(b2,#OnMouseLeave,@Window2_OK_OnMouseLeave())
lv2 = ListViewGadget(#PB_Any,3,30,293,160)
;enter the main loop
ClassWindowMain()
;program will end when all window are closed


Top
 Profile  
 
 Post subject: Re: OPB v0.54 (objective PB)
PostPosted: Sat Dec 24, 2011 2:00 am 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 2485
Location: New Zealand
Added Foreign Function Interface class based on code by Wilbert
so you can call functions in libs with varargs

Code:
file.s = OpenFileRequester("FFI","","*.*",1)
;open a lib loads it's exported functions
Global mlib = FFI_OpenLibrary(file,@enumfuncs())

;make wrapper functions to call the library functions
Procedure.f Foof(a.f,b.f)
  Static fn
  If Not fn   ;get the named function and set the number of parameters
    fn = FFI_GetFunction(mlib,"foof",2)
  EndIf   
  FFI_PushF(fn,a) ;push the parameters by type
  FFI_PushF(fn,b)
  ProcedureReturn FFI_CallF(fn)   ;call the function via the required return type
EndProcedure

Procedure.s Foos()
  Static fn
  If Not fn
    fn = FFI_GetFunction(mlib,"foos",0)
  EndIf
  ProcedureReturn PeekS(FFI_CallL(fn))
EndProcedure

;call the functions
Debug StrF(Foof(5.5,4.3))
Debug foos()

;free the library
FFI_FreeLibrary(mlib) 


Top
 Profile  
 
 Post subject: Re: OPB v0.54 (objective PB)
PostPosted: Wed Feb 15, 2012 7:01 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Apr 29, 2003 9:18 pm
Posts: 1115
Location: North by Northwest
@idle,
downloaded the v054 and wanted to add the GUI stuff I added to v53 a while ago but while doing it I realized that the NewWindow procedure should actually return the WindowNumber instead of the class instance.
This way it can be used as a "normal" PureBasic Window and the OPBWindowGetWindowNumber and OPBWindowGetWindowID procedures are not needed anymore.
In my version of v053 I also substituted OPBWindowAddGadget with NewButton, NewPanel etc. as OPBWindowAddGadget looked to cryptic.

All OPB procedures that need the class information could retrieve the class instance through the WindowNumber.

This approach would align OPB to PureBasic instead of doing his own thing.

What do you think?


Top
 Profile  
 
 Post subject: Re: OPB v0.54 (objective PB)
PostPosted: Wed Feb 15, 2012 7:24 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 2485
Location: New Zealand
Yes sounds like a better plan.


Top
 Profile  
 
 Post subject: Re: OPB v0.54 (objective PB)
PostPosted: Sun Mar 11, 2012 3:31 am 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 2485
Location: New Zealand
updated v0.55

removed introspection
updated the event driven window class so it returns the PB object numbers
added the FFI into the runtime (FFI is 32bit only at the moment)

changed how to start and stop OPB by calling OPBStart() and OPBStop()
it returns a module instance, though you can still create additional modules
also if it's used from a Dll you will need to call OPBClose() to close the lib


Top
 Profile  
 
 Post subject: Re: OPB v0.55 (objective PB)
PostPosted: Mon Mar 12, 2012 11:58 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 2485
Location: New Zealand
quick update v0.55.1
Changed a classes user data store to a dynamic structure
so it's only instantiated if you call OPBClassSetData() when building a class or passing it through.


Top
 Profile  
 
 Post subject: Re: OPB v0.56 (objective PB)
PostPosted: Fri Mar 16, 2012 5:56 am 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 2485
Location: New Zealand
update v.56
made it compatible with Interfaces


Top
 Profile  
 
 Post subject: Re: OPB v0.56 (objective PB)
PostPosted: Sun Mar 18, 2012 6:59 am 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 2485
Location: New Zealand
Added in remaining PB types to FFI


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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