Hot Topic (More than 10 Replies) Newbe Question: "Clickable" URL Field in form? (Read 1461 times)
BlueNote
Member
*
Offline



Posts: 2
Joined: Feb 3rd, 2008
Newbe Question: "Clickable" URL Field in form?
Feb 3rd, 2008 at 5:52pm
Print Post Print Post  
I'm a long-time (old) Q&A 4 guy just starting my first Sesame ap and am hoping to be able to include
fields containing URL's that can be clicked on to result in a pop-up of the associated web page.
Is this possible?  I've scanned the manuals but am not even sure what you would call this.

Any help is most appreciated.

  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Newbe Question: "Clickable" URL Field in form?
Reply #1 - Feb 3rd, 2008 at 7:03pm
Print Post Print Post  
One way to do that, is to put a very small command button next to the field that contains the URL. (I simply use "<" as the command button's label, and place the button to the right of the URL field.) This allows the user to click on the button to launch the default browser, and display the web page.

You can place this code in the Global Code event:
Code
Select All
SUBROUTINE cuOpenURL(vURL as string)

var Success as int

If vURL <> ""
{
	If @Lt(vURL, 7) <> "http://"
		vURL = "http://" + vURL

	Success = @AsynchShell(vURL)
}

END SUBROUTINE
 



Then place this in a command button's On Element Entry event, putting the name of the field (layout element) that contains the URL, between the paretheses:
Code
Select All
cuOpenURL(Website) 



The reason for using a subroutine, is that it makes it easy to use this same code for multiple URL fields.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Acebanner
Full Member
***
Offline



Posts: 123
Location: New York City
Joined: Jan 23rd, 2008
Re: Newbe Question: "Clickable" URL Field in form?
Reply #2 - Feb 8th, 2008 at 3:49pm
Print Post Print Post  
I'm also a Sesame noob and longtime Q&A 4.0 user -- thanks for this bit of code, Carl, it worked for me.
How would you use similar code to make an email launch button? Or is there some easier way? Also, what does the 'Success' variable accomplish? I figured it would get filled with a '1' or '0' depending on the result.

Anyway, thanks for the snippet -- very useful!  Smiley
  
Back to top
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Newbe Question: "Clickable" URL Field in form?
Reply #3 - Feb 8th, 2008 at 4:52pm
Print Post Print Post  
Acebanner wrote on Feb 8th, 2008 at 3:49pm:
I'm also a Sesame noob and longtime Q&A 4.0 user -- thanks for this bit of code, Carl, it worked for me.
How would you use similar code to make an email launch button? Or is there some easier way? Also, what does the 'Success' variable accomplish? I figured it would get filled with a '1' or '0' depending on the result.

Anyway, thanks for the snippet -- very useful!  Smiley


Command Button :: On Element Entry
Code
Select All
var vMail as String
var vLaunch as Int
   vMail = "mailto:" + Email_Element
   vLaunch = @Asynchshell(vMail) 



The success variable (in this case vLaunch) is filled with a 1 if successful and 0 is not.
  
Back to top
IP Logged
 
Acebanner
Full Member
***
Offline



Posts: 123
Location: New York City
Joined: Jan 23rd, 2008
Re: Newbe Question: "Clickable" URL Field in form?
Reply #4 - Feb 8th, 2008 at 5:11pm
Print Post Print Post  
That works, thanks!
  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Newbe Question: "Clickable" URL Field in form?
Reply #5 - Feb 8th, 2008 at 5:21pm
Print Post Print Post  
This is what I use.

Global Code:
Code
Select All
SUBROUTINE cuSendEmail(vStr as string)

var Success as int

If vStr <> ""
	Success = @AsynchShell("mailto:" + vStr)

END SUBROUTINE
 



In the command button:
Code
Select All
cuSendEmail(BusinessEmail) 



BTW, the 'Success' variable is for nothing more than to allow us to use @AsynchShell. Because @AsynchShell returns a value, you need to put that value somewhere, even if we don't want to use it for anything.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Newbe Question: "Clickable" URL Field in form?
Reply #6 - Feb 8th, 2008 at 6:19pm
Print Post Print Post  
Just curious, Carl, but what does the "cu" prefix stand for in your code?
  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Newbe Question: "Clickable" URL Field in form?
Reply #7 - Feb 8th, 2008 at 7:12pm
Print Post Print Post  
Infinity wrote on Feb 8th, 2008 at 6:19pm:
Just curious, Carl, but what does the "cu" prefix stand for in your code?

Carl's first name starts with ...?
Carl's last name starts with...?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Newbe Question: "Clickable" URL Field in form?
Reply #8 - Feb 8th, 2008 at 10:24pm
Print Post Print Post  
Hammer wrote on Feb 8th, 2008 at 7:12pm:
Infinity wrote on Feb 8th, 2008 at 6:19pm:
Just curious, Carl, but what does the "cu" prefix stand for in your code?

Carl's first name starts with ...?
Carl's last name starts with...?

Erika's correct.

It's my initials. But it could also be short for 'Custom', as in 'custom function'; which is how I first started using that prefix. I wanted to differentiate @Rnd() from my custom version, so I named mine @cuRnd(). That led me to start using it for subroutines also. This way, I always know when something is my custom creation, or a built-in command or function of SBasic.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
MP
Full Member
***
Offline



Posts: 104
Joined: Sep 3rd, 2007
Re: Newbe Question: "Clickable" URL Field in form?
Reply #9 - Feb 8th, 2008 at 10:26pm
Print Post Print Post  
Infinity wrote on Feb 8th, 2008 at 6:19pm:
Just curious, Carl, but what does the "cu" prefix stand for in your code?

The point of a prefix like that (at least from my perspective) is to differentiate a user function from a system function.  This is for code maintainability, such that you know when you see the function being called that it's definition is found in the GLOBAL CODE section and not the Sesame documentation.

I make liberal use of prefixes in my development.  In Sesame, I have standard prefixes for variables, fields, LEs, subroutines and functions.
  
Back to top
 
IP Logged
 
BlueNote
Member
*
Offline



Posts: 2
Joined: Feb 3rd, 2008
Re: Newbe Question: "Clickable" URL Field in form?
Reply #10 - Feb 10th, 2008 at 5:12pm
Print Post Print Post  
Carl:

Just wanted to say THANK YOU.  My new (1st) ap is up and running better than I had imagined.  Don't know
how I would have done it without the help.  Smiley

Thanks Again,

Paul
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Newbe Question: "Clickable" URL Field in form?
Reply #11 - Feb 10th, 2008 at 8:38pm
Print Post Print Post  
BlueNote wrote on Feb 10th, 2008 at 5:12pm:
Carl:

Just wanted to say THANK YOU.  My new (1st) ap is up and running better than I had imagined.  Don't know
how I would have done it without the help.  Smiley

Thanks Again,

Paul

Your welcome. Glad it helped. Smiley
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged