Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Dialog unbuffered problems  (Read 17892 times)
Massimiliano D.
Posts: 15


« on: February 13, 2010, 12:14:03 am »

Hi, i'm trying to make a form like one of the multiple dialog demo with an input block and a display array block under input.
I would like to refresh the displayed data immediatly whne the user change the current input field so i do something like this:


dialog (attribute unbuffered)
 
   input by name my_record.*
     
      ...

      on action dialogtouched
          call rebuild_select(my_record.*)
             returning my_select

          declare my_cursor from my_select
          call my_array.appendElement()
          foreach my_cursor into my_array[my_array.getLength()].*
             call my_array.appendElement()
          end foreach
          call my_array.removeElement(my_array.getLength()) 
          ...
   end input
   display array my_array to sc_array.* attributes (count=my_array.getlenght())
      ...
   end display

   ...
end dialog

it works quite well, but if i try to add a space in the current input field, when the dialogtouched action triggers, my current input filed are automatically right trimmed.

so i try with an costruct sub dialog, and the input field dont lose the trailing space, but a costruct build a query with the like operator only if the current field contains '*' so i try to change the current input buffer of the construct with the FGL_DIALOG_SETBUFFER( ) but the application crashes, it only works without the unbuffered mode.
How can i do?

Thanks Max
Reuben B.
Four Js
Posts: 1116


« Reply #1 on: February 14, 2010, 09:53:26 pm »

Hi Max,

What version?  One of my customers reported something similar to this last year(Bz12751 String value should not be truncated when using dialogtouched action).

You should also be careful with (and it may be an indication that you are using a 2.1 version) ...

on action dialogtouched
   call rebuild_select(myrecord.*)

... as the my_record.field for the current field won't be populated.  Within on action dialogtouched, what you have typed into the current field is still in the buffer FGL_DIALOG_GETBUFFER(), even if using UNBUFFERED.  The reason for that, imagine if myrecord.field was an INTEGER or  DATE, and the user types in "abc". 

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Massimiliano D.
Posts: 15


« Reply #2 on: February 15, 2010, 08:53:21 am »

fglrun version1 :
fglrun -V

fglrun 2.20.09 build-1369.136
Built Sep 11 2009 14:46:02
(c) 1989-2009 Four J's Development Tools

but it happens with 2.11.10 buid-1169.136

in input by name my_record.* all of my_record fileds are string or integer


.
Four Js
Posts: 115


« Reply #3 on: February 15, 2010, 09:26:08 am »

Just a side note on dialogtouched method:

I would recommend to use it carefully: for each keystroke GDC sends the content of the field to the runtime system and waits for the answer. On a fast network this is ok, but if you intend to deploy your application on a slower network it may have a big impact on performances - for instance if you're running GDC through https with authentication, each time the http keep-alive times out a new connection is made, with ssl handshake and authentication which may take a little time.
And what can be acceptable for the end user when leaving a field may not be understood for each key press.

Massimiliano D.
Posts: 15


« Reply #4 on: February 15, 2010, 09:38:40 am »

OK, thanks for the note, in fact i use the dialogtouched only few times, for a user friendly serch, is there any work-around??

Regars Max
Sebastien F.
Four Js
Posts: 545


« Reply #5 on: February 15, 2010, 10:20:54 am »

The dialogtouched action should only be used to detect that the user has started to modify the current record.

https://4js.com/techdocs/genero/fgl/devel/DocRoot/User/MultipleDialogs.html#detecting-changes

Seb
Reuben B.
Four Js
Posts: 1116


« Reply #6 on: February 16, 2010, 05:00:15 am »

Max,

Attached is an example I used at presentations in my region when 2.20 was released.  Looking back at it, it is very similar to what you are trying to achieve.  If you look near the end of the code, there is an entry you can uncomment to verify that trailing spaces is treated correctly.

As well as updating the list based on what you type, I change the style to indicate a good or a bad value.

As others have commented, be conscious of network traffic, and only have the action active where necessary.

Seb, Pierre-Nicolas:  Go to google and type part of a search phrase into the search box and do nothing for 1 second, it will come back with a list of 10 top search expressions.  That is similar to type of functionality I was aiming for in my example.  It maybe that ON ACTION dialogtouched is not the best method to achieve something similar but it is what we have got.  A variation of ON IDLE that is only triggered once would've been the preferred choice e.g.

Code
  1. ON IDLE 1 DONTREPEAT
  2.  -- if user doesn't input for 1 second, display a list of possibe values based on what they have keyed so far.
  3.  -- only does this once, if the user continues to do nothing don't trigger this block every second like ON IDLE 1 would
  4.  -- when the user does soemthing, then the timer can be reset.
  5.   CALL display_list()

Reuben

* dialogtouched.4gl (10.05 KB - downloaded 994 times.)
* dialogtouched.4st (0.43 KB - downloaded 971 times.)
* dialogtouched.per (0.58 KB - downloaded 993 times.)

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
.
Four Js
Posts: 115


« Reply #7 on: February 16, 2010, 07:15:37 am »

Reuben,

Don't misunderstand me.
I'm ok with this pattern and I'm ok with the feature. I'm just underlining this could be a performance bottleneck on slow networks and that you've to be aware of that before implementing this everywhere.

I would also do something like

   ON ACTION dialogtouched IN FIELD search

Instead of a global ON ACTION for a 100 fields dialog, so the action is only active in the "search" field - if you're doing a google like form.
Sebastien F.
Four Js
Posts: 545


« Reply #8 on: February 16, 2010, 09:29:55 am »

Reuben,

Just a quick thought but can your suggestion with ON IDLE 1 DONTREPEAT not be implemented by mixing the regular ON IDLE trigger with ON ACTION dialogtouched, by using your own flag?

Seb
Massimiliano D.
Posts: 15


« Reply #9 on: February 16, 2010, 11:15:14 am »

Reuben,
... implementing this everywhere.


Ok, you're right Pierre for the traffic network and i had already read the manual entry for special dialogtouched action about the network traffic and i don't wanna use this feature everywehere, but it's a way to provide to the final user a very simple search.
Seb, it's exactly what i'm looking for!
Much appreciate this.

Regards Max
Reuben B.
Four Js
Posts: 1116


« Reply #10 on: February 19, 2010, 06:08:47 am »

Reuben,

Just a quick thought but can your suggestion with ON IDLE 1 DONTREPEAT not be implemented by mixing the regular ON IDLE trigger with ON ACTION dialogtouched, by using your own flag?

Seb

Probably but the ON IDLE 1 will keep triggering every 1 second (and also I'd prefer to keep ON IDLE for a timeout).  I'm assuming it is still not possible to enable and disable the ON IDLE trigger via setActionActive().

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Sebastien F.
Four Js
Posts: 545


« Reply #11 on: February 19, 2010, 08:12:02 am »

Reuben,

No setActionActive() has no effect on the ON IDLE trigger, because it's not an action.
Feel free to file a new bug/enhancement for that, should not be a big deal to do a DIALOG.setIdleTimeoutActive()

Seb
Massimiliano D.
Posts: 15


« Reply #12 on: February 22, 2010, 11:41:51 am »

Seb one last question, is possible to use the on fill buffer in this kind of dialog??
becouse i can't do this.

Thanks for the help
Regards Max
Sebastien F.
Four Js
Posts: 545


« Reply #13 on: February 22, 2010, 12:03:12 pm »

Seb one last question, is possible to use the on fill buffer in this kind of dialog??
becouse i can't do this.

Thanks for the help
Regards Max

ON FILL BUFFER (paged mode) should work in DIALOG + DISPLAY ARRAY, see:

https://4js.com/techdocs/genero/fgl/devel/DocRoot/User/MultipleDialogs.html#paged-mode

Please contact us via support channel with code example, so we can analyze your case.

Seb
Massimiliano D.
Posts: 15


« Reply #14 on: February 22, 2010, 03:57:17 pm »

Ok, i found a way to do this.
Thanks for the help!!!
Regards Max
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines