TailBite 1.0 Preview, soon in PureProject and PureArea

TailBite specific forum

Moderators: gnozal, ABBKlaus, lexvictory

User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

Small question : how are managed protoypes with tailbite ?
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

same restrictions as ProcedureDLL, no optional parameters.
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1282
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

ABBKlaus wrote:@Maxus,
Please supply a snippet for what is not working :wink:

This is from the TailBite manual and should work :
You can make your function accept variable arguments. To do so, you must include two or more ProcedureDLL's with the same name and an index number:

This use to work in TailBite for PB3.94

Code: Select all

ProcedureDLL.l MsgTest3(Line.s,Title.s,Icon.l)
  MessageRequester(Title,Line,Icon)
EndProcedure

ProcedureDLL.l MsgTest2(Line.s,Title.s)
  MsgTest3(Line,Title,#MB_ICONINFORMATION)
EndProcedure

ProcedureDLL.l MsgTest(Line.s)
  MsgTest3(Line,"Hello",#MB_ICONINFORMATION)
EndProcedure
And your arguments would be...
MsgTest(Line.s [, Title.s [, Icon.l]])

If you TailBite this code for PB4.x you get...
MsgTest(Line.s [, Title.s , Icon.l])

Latest TailBite seems to only recognize 1 additional argument, not multiple arguments.
Image Image
User avatar
Maxus
User
User
Posts: 71
Joined: Thu Feb 16, 2006 9:35 am
Location: Russia
Contact:

Post by Maxus »

Code: Select all

ProcedureDLL DEbuger_Init()
  Global ST=1
EndProcedure

ProcedureDLL.l MSGBOX(String.s, FColor.l)
  If Not IsWindow(0)
    ExamineDesktops()
    LoadFont(0,"Sans Serif",8,#PB_Font_Bold)
    OpenWindow(0,0,0,DesktopWidth(0),400,"Debug"):CreateGadgetList(WindowID(0))
    ListIconGadget(0,5,5,DesktopWidth(0)-10,390,"Message",DesktopWidth(0)-31,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
    SetGadgetFont(0,FontID(0))
  EndIf
  AddGadgetItem(0,-1,String$)
  If Fcolor=-1:Fcolor=0:EndIf
  SetGadgetItemColor(0,CountGadgetItems(0)-1,#PB_Gadget_FrontColor,FColor)
  If ST=0
    SetGadgetItemColor(0,CountGadgetItems(0)-1,#PB_Gadget_BackColor,$EEEEEE):ST=1
  Else
    SetGadgetItemColor(0,CountGadgetItems(0)-1,#PB_Gadget_BackColor,$FFFFFF):ST=0
  EndIf
EndProcedure


ProcedureDLL.l MSGBOX2(String$)
  MSGBOX(String$,-1)
EndProcedure

ProcedureDLL DECL()
  ClearGadgetItemList(0)
EndProcedure

ProcedureDLL DEbuger_End()
If IsWindow(0)
  Repeat
  Until WindowEvent()=#PB_Event_CloseWindow
EndIf
EndProcedure 
This code not work in PB 4.10b2

What's wrong? ? ?
Sorry my English, I'm Russian
AMT Laboratory
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

@Paul
i know this worked in PB3.94 but i don´t have that sources anymore :( (TailBite1.3B0.1)
this works in the current version of TailBite :

Code: Select all

Declare.l MsgTest3(Line.s,Title.s,Icon.l)

ProcedureDLL.l MsgTest(Line.s) 
  MsgTest3(Line,"Hello",#MB_ICONINFORMATION) 
EndProcedure 

ProcedureDLL.l MsgTest2(Line.s,Title.s) 
  MsgTest3(Line,Title,#MB_ICONINFORMATION) 
EndProcedure 

ProcedureDLL.l MsgTest3(Line.s,Title.s,Icon.l) 
  MessageRequester(Title,Line,Icon) 
EndProcedure 
@Maxus :
some typing errors with string$/string.s and i prefer internal procedures. That way you can use optional parameters :wink:

Code: Select all

ProcedureDLL DEbuger_Init() 
  Global ST=1 
  Global Window_MSGBox
  Global Font_SansSerif
  Global ListIcon_MSGBox
EndProcedure 

Procedure.l ipf_MSGBOX(String.s, FColor.l=-1) 
  If Not IsWindow(Window_MSGBox) 
    ExamineDesktops() 
    Font_SansSerif=LoadFont(#PB_Any,"Sans Serif",8,#PB_Font_Bold) 
    Window_MSGBox=OpenWindow(#PB_Any,0,0,DesktopWidth(0),400,"Debug"):CreateGadgetList(WindowID(Window_MSGBox)) 
    ListIcon_MSGBox=ListIconGadget(#PB_Any,5,5,DesktopWidth(0)-10,390,"Message",DesktopWidth(0)-31,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect) 
    SetGadgetFont(ListIcon_MSGBox,FontID(Font_SansSerif)) 
  EndIf 
  AddGadgetItem(ListIcon_MSGBox,-1,String) 
  If Fcolor=-1:Fcolor=0:EndIf 
  SetGadgetItemColor(ListIcon_MSGBox,CountGadgetItems(ListIcon_MSGBox)-1,#PB_Gadget_FrontColor,FColor) 
  If ST=0 
    SetGadgetItemColor(ListIcon_MSGBox,CountGadgetItems(ListIcon_MSGBox)-1,#PB_Gadget_BackColor,$EEEEEE):ST=1 
  Else 
    SetGadgetItemColor(ListIcon_MSGBox,CountGadgetItems(ListIcon_MSGBox)-1,#PB_Gadget_BackColor,$FFFFFF):ST=0 
  EndIf 
EndProcedure 


ProcedureDLL.l MSGBOX(String.s) 
  ipf_MSGBOX(String) 
EndProcedure 

ProcedureDLL.l MSGBOX2(String.s,FColor.l) 
  ipf_MSGBOX(String,FColor) 
EndProcedure 

ProcedureDLL DECL() 
  ClearGadgetItemList(ListIcon_MSGBox) 
EndProcedure 

ProcedureDLL DEbuger_End() 
  If IsWindow(Window_MSGBox) 
    Repeat 
    Until WindowEvent()=#PB_Event_CloseWindow 
  EndIf 
EndProcedure 
PS:
the order of the functions is essential in the current version of TailBite :!:

Right usage :

Code: Select all

ProcedureDLL SomeFunction(Param1)
EndProcedure

ProcedureDLL SomeFunction2(Param1,Param2)
EndProcedure

ProcedureDLL SomeFunction3(Param1,Param2,Param3)
EndProcedure
Regards Klaus
Last edited by ABBKlaus on Tue Jul 10, 2007 8:25 pm, edited 1 time in total.
User avatar
Maxus
User
User
Posts: 71
Joined: Thu Feb 16, 2006 9:35 am
Location: Russia
Contact:

Post by Maxus »

ABBKlaus - Thanks this method working. :lol:
Sorry my English, I'm Russian
AMT Laboratory
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

update is out : TailBite v1.3 PR 1.848

- should be more VISTA compatible now, TailBite_Intstaller.exe + TBUpdater.exe now request administrator mode
would be nice if someone could test this, i don´t have vista atm :oops:
- fixed : the preferences are loaded correctly now
- fixed : under some conditions the Compilers folder could be deleted
- added : Subsystem now changes accordingly to the checkboxes

Regards Klaus
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

ABBKlaus wrote:same restrictions as ProcedureDLL, no optional parameters.
Excuse me but if I declare a prototype like this, MsgBox doesn't become a function...

Code: Select all

ProcedureDLL Lib_Init()
 OpenLibrary(0, "User32.dll")
Endprocedure

Prototype.l ProtoMessageBox(Fenetre.l, Corps$, Titre$, Options.l = 0)
Global MsgBox.ProtoMessageBox = GetFunction(0, "MessageBoxA")
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 »

@Progi1984
Your MsgBox-Function is like a variable, so you can't export it in a lib.

You have to wrappe this in a ProcedureDLL like:

Code: Select all

Prototype.l ProtoMessageBox(Fenetre.l, Corps$, Titre$, Options.l)

ProcedureDLL Lib_Init()
  OpenLibrary(0, "User32.dll")
  Global MsgBox_.ProtoMessageBox = GetFunction(0, "MessageBoxA")
EndProcedure

Procedure MsgBox(Fenetre.l, Corps$, Titre$)
  ProcedureReturn MsgBox_(tre.l, Corps$, Titre$, 0)
EndProcedure

Procedure MsgBox2(Fenetre.l, Corps$, Titre$, Options.l)
  ProcedureReturn MsgBox_(tre.l, Corps$, Titre$, Options)
EndProcedure
but this make no sense :wink:
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
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

Thanks you for your answer... i prefer in this case use Callfunction
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

@TS-Soft :

small bug in your example :shock:

Code: Select all

Prototype.l ProtoMessageBox(Fenetre.l, Corps$, Titre$, Options.l=0) 

ProcedureDLL Lib_Init() 
  Global User32
  Global MsgBox_.ProtoMessageBox
  
  User32=OpenLibrary(#PB_Any, "User32.dll") 
  If User32
    MsgBox_ = GetFunction(User32, "MessageBoxA")
  EndIf
EndProcedure 

ProcedureDLL Lib_End() 
  If IsLibrary(User32)
    CloseLibrary(User32)
  EndIf
EndProcedure 

ProcedureDLL MsgBox(Fenetre.l, Corps$, Titre$) 
  If MsgBox_
    ProcedureReturn MsgBox_(tre.l, Corps$, Titre$) 
  EndIf
EndProcedure 

ProcedureDLL MsgBox2(Fenetre.l, Corps$, Titre$, Options.l) 
  If MsgBox_
    ProcedureReturn MsgBox_(tre.l, Corps$, Titre$, Options) 
  EndIf
EndProcedure
@Progi1984 please forget what i said about the prototypes and optional parameters, should work with it :oops:
Last edited by ABBKlaus on Tue Jul 10, 2007 8:10 pm, edited 1 time in total.
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 »

Code: Select all

OpenLibrary(0, "User32.dll") 
And in a lib you should use the dynamic IDs: #PB_Any ! (for all, not only for DLLs)
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
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

ts-soft wrote:

Code: Select all

OpenLibrary(0, "User32.dll") 
And in a lib you should use the dynamic IDs: #PB_Any ! (for all, not only for DLLs)
good point ts-soft 8)
this should be true for all PB-ID´s !

PS: i replaced all examples above with #PB_Any´s
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

@ABBKlaus : continued thanks for your great work. Just wondering though if you might create another thread where the latest versions of Tailbite could be easily found, i.e. the most up to date link kept permanently in the first post etc? As it is I always seem to miss the latest updates!

Thanks.


**EDIT: just compiled a lib with the unicode switch. Is this new version of Tailbite supposed to place the compiled lib in the unicode subsystem? In my case it is simply placing it in the regular PureLibraries\UserLibraries folder etc.
I may look like a mule, but I'm not a complete ass.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

@srod i will do that when i completed the new website for tailbite :wink:
Post Reply