Opening a web page with a button Click

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

Opening a web page with a button Click

Postby gsharma84 » Sat Jun 12, 2010 1:57 pm

I want to do a very simple thing. I want to click on a button and that button is suppose to open and web page in internet explorer or whatever my default web browser is...I don't have any clue as to were should I start on this...
Can anyone in the forum guide me...
Later on I would be working on passing parameters to the webpage but to get started I first need to open a web page with button click.
Please assist, thanks!
Posts: 16
Joined: Mon Dec 21, 2009 8:20 pm

Re: Opening a web page with a button Click

Postby marten » Sat Jun 12, 2010 10:47 pm

You might have a look at the AbtHTMLHelpAccessor class ...
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: Opening a web page with a button Click

Postby tstalzer » Sun Jun 13, 2010 2:12 am


Have a look at the class AbtProgramStarter. If you pass the name of the HTML file to new system process, the file will open with its associated application.

Note: This is "just" for Windows. However, as you mention IE, I assume this is true.

Below is some samplecode to open the "d:\disk_s\httpRoot\index.html" file in the browser

Code: Select all
   | startUpInfo processInformation rc |   
   (startUpInfo := OSStartupinfo new)
      dwFlags: PlatformConstants::StartfUseshowwindow;
      wShowWindow: PlatformConstants::SwShownormal.
   os := OSCall new   .
   rc := os createProcess: nil
      lpszCommandLine: 'cmd /C d:\disk_s\httpRoot\index.html'
      lpsaProcess: 0
      lpsaThread: 0
      fInheritHandles: false
      fdwCreate: PlatformConstants::NormalPriorityClass
      lpvEnvironment: 0
      lpszCurDir: nil
      lpsiStartInfo: startUpInfo
      lppiProcInfo: (processInformation := OSProcessInformation new).

   rc inspect.
   os getLastError inspect

Don't forget to look at the error messages

Posts: 65
Joined: Mon Oct 16, 2006 12:07 am
Location: Palma de Mallorca - Spain

Re: Opening a web page with a button Click

Postby benvandijk » Sun Jun 13, 2010 10:57 pm


The shortest way to open any file or url in windows:

Code: Select all
OSHwnd new
         shellExecute: 'open'
         lpFile: 'c:\myhtml.html'
         lpParameters: nil
         lpDirectory: nil
         nShowCmd:   3 "PlatformConstants::SwShowmaximized"

Windows will find the application and open the file
Posts: 45
Joined: Sun Feb 25, 2007 7:14 am
Location: Arnhem, Netherlands

Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: No registered users and 1 guest