GTRR scripts in Servoy

Questions, tips and tricks and techniques for scripting in Servoy

GTRR scripts in Servoy

Postby swingman » Sat Oct 04, 2003 10:43 am

Hi,

I use a lot of HTML-style hyperlinks in my FileMaker databases.
Whenever the user sees a blue underlined field, they can click on it and go to the relevant record in the database.

For example: If you are in a company database and click on a person's name in a portal this will take you to that person's record in the person database..

So I frequently do the following in FileMaker:

if(status(currentmode) <> 1) {
//check i'm not in Find Mode, otherwise it will not be posssible to do a find
Perform script(Related Database,Enter Browse Mode)
//GTRR does not work when related database is not in browse mode
Go To Related Record(RelationshipName,show)
//Shows only the related records
Perform script(Related Database,Go to some layout)
} else {
//i'm in find mode
Go to Field(The field I clicked on)
}

How do I script this in Servoy, the Servoy way?
User avatar
swingman
 
Posts: 1474
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Postby dlundgren » Sat Oct 04, 2003 7:41 pm

I think its

forms.client_calls.controller.showRecords(client_data_to_client_calls);

where client_calls is the form you're going to and the parenthesis describe the relationship

I'm new here too, but it works for me

Dave
dlundgren
 
Posts: 14
Joined: Sat Sep 20, 2003 6:19 pm
Location: Waterford, NY

Postby swingman » Sun Oct 05, 2003 8:07 pm

Hi Dave,
thanks for pointing out that I have to specify the form I wan't to go to, when using showRecords.

Just tried leaving my related form in Find-mode before trying the new script and it still worked. This will mean there will be less code to write than in FileMaker.

I still have a couple of issues:
- According to the documentation there is no Servoy equivalent of status(currentMode). Is there any way of detecting Find mode?
- If I attach the script to the onAction of an uneditable text field and I click on the textfield, the script does not get executed. If I attach it to onFocusGained it works, that will mean you the script get activated it you tab through the fields :-(
User avatar
swingman
 
Posts: 1474
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Postby jcompagner » Sun Oct 05, 2003 11:33 pm

No en Textfield onAction only works if you can press the action key: Enter in that field.
If you make it non editable then that is not possible.

But why aren't you using a button? Just as easy...
User avatar
jcompagner
 
Posts: 8852
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby swingman » Mon Oct 06, 2003 2:56 pm

Since I'm using this user interface element a lot, I'm trying to avoid the workaround of putting a button on top of a field.

I have attached a screenshot.

In this case, clicking the link takes you to the record of the person. The round symbol is for editing the hyperlink. Clicking it takes you to separate screen which allows you to find and select people. This functionality was very easy to implement in Servoy :-) I use this technique since some of our databases may contain 10,000s of records. Using Filemaker value lists would be very slow.

In Find mode, you just click on the link-field and enter your search crieria, just like any other field.
Attachments
hyperlink.gif
hyperlink.gif (1.72 KiB) Viewed 9193 times
User avatar
swingman
 
Posts: 1474
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Postby Jan Blok » Mon Oct 06, 2003 9:47 pm

We could make the field onAction behave the same as button onAction when not editable. (when doing find it is possible to enter data in not editable field)
Not sure if all other solution developers whould agree with this behaviour...
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby swingman » Tue Oct 07, 2003 4:14 pm

Is it possible to subclass Textfield to change the behaviour?
User avatar
swingman
 
Posts: 1474
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Postby Jan Blok » Tue Oct 07, 2003 4:44 pm

you can use the onFocusGained property to get the behaviour you want (we just realized)
-when in edit mode and the field is not editable onFocusGained method is still called when clicking on the field
-when in find mode the field is always editable en no events are fired.
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby swingman » Tue Oct 07, 2003 6:20 pm

I tried this, but if you tab through the fields, a non-editable field will gain focus and trigger the hyperlink...

That is why I would like to use onAction. The user should click on the field to to traverse the link.
User avatar
swingman
 
Posts: 1474
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Postby jcompagner » Wed Nov 05, 2003 5:14 pm

onAction method will also be called now on a mouseClick inside a textfield that is not editable (will be in 1.2 final)
User avatar
jcompagner
 
Posts: 8852
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby swingman » Sat Nov 08, 2003 11:02 pm

Great! :D
User avatar
swingman
 
Posts: 1474
Joined: Wed Oct 01, 2003 10:20 am
Location: London


Return to Methods

Who is online

Users browsing this forum: No registered users and 3 guests

cron