bBrowser

This forum is meant for examples of X# code.

User avatar
gianluca.pinoli
Posts: 36
Joined: Mon Nov 02, 2015 1:13 pm
Location: Italy

bBrowser

Post by gianluca.pinoli »

Hi everyone,
I'm a newbie with X# (and .NET in general).
I'm trying to use bBrowser 4.0 for Vulcan in X# but I Always get a general error.
Has anybody a sample to share?

Regards
Gianluca
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

bBrowser

Post by wriedmann »

Hi Gianluca,

bBrowser for Vulcan should work in X#, and it should also compile in X# (with a few corrections).

Where do you get the general error? Compiling? Running?

Please specify better what your problem is.

Wolfgang

P.S. this is a bBrowser in a xPorted VO application (running in X#):
DictEdit_XSharp.png
DictEdit_XSharp.png (170.99 KiB) Viewed 864 times
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
gianluca.pinoli
Posts: 36
Joined: Mon Nov 02, 2015 1:13 pm
Location: Italy

bBrowser

Post by gianluca.pinoli »

Hi Wolfgang,
i tried restarting with a new project in XIDE.
in the images below you can see my simple app, i suspect the problem is the ResouceID, but i can't find a solution.
By the way the bTools.xxx.dll are compiled following your (really appreciated) guide.

Thank You very much for your help.

Gianluca
Attachments
Immagine3.jpg
Immagine3.jpg (68.43 KiB) Viewed 864 times
Immagine.jpg
Immagine.jpg (70.17 KiB) Viewed 864 times
Immagine2.jpg
Immagine2.jpg (55.2 KiB) Viewed 864 times
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

bBrowser

Post by wriedmann »

Ciao Gianluca,

please try to log your exception somewhere. On the image it is really hard to try.

I'm using this code for this purpose:

Code: Select all

static method ProcessException( oException as Exception ) as void
local cMessage as string
	
cMessage := oException:Message
VOXSErrorHandler.WriteErrorLog( oException )
do while oException:InnerException != NULL_OBJECT
  oException := oException:InnerException
  VOXSErrorHandler.WriteErrorLog( oException )
  cMessage += CRLF + oException:Message
enddo
VOXSErrorHandler.ErrBox( cMessage )
	
return
	
static method WriteErrorLog( oException as Exception ) as void
local cFileName as string
local cErrorText as string
local oSB as StringBuilder

cFileName := Path.Combine( AppDomain.CurrentDomain:BaseDirectory, "XSharpError.log" )
oSB := StringBuilder{ String.Format( "Error occurred in {0} at {1}", Assembly.GetEntryAssembly():Location, DateTime.Now:ToString() ) }
oSB:AppendLine( "------------------------------------------------------------" )
oSB:AppendLine( oException:Message )
oSB:AppendLine( "Callstack:" )
oSB:AppendLine( oException:StackTrace )
oSB:AppendLine( "" )
File.AppendAllText( cFileName, oSB:ToString() )
	
return
HTH

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
gianluca.pinoli
Posts: 36
Joined: Mon Nov 02, 2015 1:13 pm
Location: Italy

bBrowser

Post by gianluca.pinoli »

Ciao Wolfgang,
this is whath i get from the debug:

#################################################################################################
Vulcan.VO.WCError

Callstack :
bTools.bBrowser.bBrowser.System.Void bTools.bBrowser.bBrowser..ctor(Vulcan.__Usual[] Xs$Args)() : C:XIDEProjectsbBrowser4ApplicationsbBrowserControlsbBrowser (Control).prg : 382
BasicForm.System.Void BasicForm..ctor()() : C:XIDEProjectsTestBB4ApplicationsFormApp1PrgForm1.prg : 20
static Int32 FormApp1.Exe.Functions.Start(System.String[] asCmdLine)() : C:XIDEProjectsTestBB4ApplicationsFormApp1PrgStart.prg : 13
#################################################################################################


By the way.. How can I use your logging function? Does it need any external reference?

Thanks
Gianluca
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

bBrowser

Post by wriedmann »

Ciao Gianluca,

no, my logging does not need any external references.

I have attached the entire prg zipped to this message.

I'm using it this way:

Code: Select all

function Start() as int

#ifdef __XSHARP__
try
#else
begin sequence
ErrorBlock( {|oError| WDefError(oError)} )
#endif

oApp		:= EnhancedApp{}
__SetAppObject( oApp )
oApp:Start()

#ifdef __XSHARP__
catch oEx as Exception
	
VOXSErrorHandler.ProcessException( oEx )
	
end try
#else	
end sequence
#endif
	
oApp:Quit()
oApp:Destroy()
oApp 		:= NULL_OBJECT
	
return 0
As you can see, I can use the same code in VO and X#, and manage the differences using #ifdef statements.

Wolfgang

P.S. in a few minutes I will leave my PC until tomorrow morning, so please don't expect any answer from me.
Attachments
VOXSErrorHandler.zip
(912 Bytes) Downloaded 103 times
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4922
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

bBrowser

Post by Chris »

Hi Gianluca,

The problem is because bBrowser is a VO GUI control but you are trying to put it in a Windows.Forms form. Theoretically it would be possible to do that, but it is not easy.

Normally you would put bBrowser in a VO-style window, for example create a new app in XIDE, select the "Standard VO MDI" template, this will create an app very similar to what you create in a similar way in VO. There you can create a new window (with Tools->VOWindow Editor) and put bBrowser in it like any other control. Also if you put your cavowed.inf and tpl files from your VO folder to XIDEConfig, then bBrowser should be visible in XIDE's toolbox, same as in VO.

But if you want to create a pure .Net app (no VO GUI), then it's more complicated. bBrowser is designed to work with VOGUI, so obvious answer is that you need one of the grid controls available for winforms or WPF in .Net. Although it would be an interesting exercise trying to make bBrowser work in winforms as well, but it will be a lot of work.

Btw, I am seeing you are getting dozens of "165" warnings, which are cluttering the compiling results. In the beginning, I would suggest to just disable reporting this specific warning, by using a /nowarn:165 in the compiler options (App properties/Compiler page, first edit on top). Or you can go to Tools/Preferences/compiler and enable "Always apply /nowarn:165".

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

bBrowser

Post by wriedmann »

Hi Chris,

after looking at the SDK sources I suspected something like this.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
gianluca.pinoli
Posts: 36
Joined: Mon Nov 02, 2015 1:13 pm
Location: Italy

bBrowser

Post by gianluca.pinoli »

Hi Chris,
i actually used Windows.Forms Form, testing bBroweser.
Thanks for your analysis of my problem.
I'll try again how you suggest

Regards
Gianluca
User avatar
gianluca.pinoli
Posts: 36
Joined: Mon Nov 02, 2015 1:13 pm
Location: Italy

bBrowser

Post by gianluca.pinoli »

Ciao Wolfganag,
thanks again for yous help.

Regards
Gianluca
Post Reply