{"id":257,"date":"2016-03-04T10:36:36","date_gmt":"2016-03-04T15:36:36","guid":{"rendered":"http:\/\/salzlechner.com\/dev\/?p=257"},"modified":"2016-03-11T06:38:00","modified_gmt":"2016-03-11T11:38:00","slug":"setactionmode-configuring-wait-or-progress-dialogs","status":"publish","type":"post","link":"http:\/\/salzlechner.com\/dev\/2016\/03\/04\/setactionmode-configuring-wait-or-progress-dialogs\/","title":{"rendered":"SetActionMode &#8211; Configuring Wait or Progress Dialogs"},"content":{"rendered":"<p>Due to the nature of the web architecture things such as displaying a progress dialog or a wait dialog has become a little more difficult<\/p>\n<p>We have the two parts to the application. A DataFlex program that runs on the web server and serves any number of requests from different clients and the Javascript code that executes on the client side in the browser.<\/p>\n<p>In case of a simple example lets say we have a button on the screen that executes some code when clicked that could take a little while. We want the user to know that there is a small wait involved so they do not think that something\u00a0is wrong.<\/p>\n<p>What happens in detail is that the user clicks on the button in the web page. That button calls its click event in the client javascript code. The client code will then call the server and execute the OnClick procedure in the DataFlex code on the server.<\/p>\n<p>The DataFlex code doesnt return back to the client until it finishes so it isnt possible to update the user interface which would require another round trip back to the client.<\/p>\n<p>Instead DataFlex has added the SetActionMode method to define a progress user interface before things are happening<\/p>\n<p>Essentially what you are doing is to tell DataFlex that if the client code were to call the buttons OnClick procedure you want to progress user interface to show.<\/p>\n<p>This can be done in the OnLoad method of the object that is going to be called later in our case the button<\/p>\n<pre class=\"lang:default decode:true\">Procedure OnLoad\r\n    Forward Send OnLoad\r\n        \r\n    Send SetActionMode (RefProc(OnClick)) scModeWait \"\"\r\nEnd_Procedure<\/pre>\n<p>The code above tells DataFlex that\u00a0the client code calls the OnClick procedure you want to show the wait Cursor. Another option is to show the progress dialog using szModeProgress .<\/p>\n<pre class=\"lang:default decode:true \">Send SetActionMode (RefProc(OnClick)) scModeProgress \"Please Wait\"<\/pre>\n<p>As mentioned earlier the method that has to be passed to SetActionMode is the one\u00a0called by the client code and cant be another method that might be called later.<\/p>\n<p>For example<\/p>\n<pre class=\"lang:default decode:true \">Procedure MyMethod\r\n  ...\r\nEnd_Procedure\r\n\r\nProcedure OnClick\r\n    Send MyMethod\r\nEnd_Procedure\r\n\r\nProcedure OnLoad\r\n    Forward Send OnLoad\r\n        \r\n    Send SetActionMode (RefProc(MyMethod)) scModeWait \"\"\r\nEnd_Procedure<\/pre>\n<p>the above will not work as the MyMethod is called from server side DataFlex code not client code.<\/p>\n<p>When calling a YesNo box for example you need to specify the proper method<\/p>\n<pre class=\"lang:default decode:true \">Procedure YesNoCallback Integer eConfirmMode\r\n    ....\r\nEnd_Procedure\r\n\r\nProcedure OnLoad\r\n    Send SetActionMode (RefProc(YesNoCallback)) scModeWait \"\"\r\nEnd_Procedure\r\n\r\nProcedure OnClick\r\n    Send ShowYesNo (Self) (RefProc(YesNoCallback)) \"Question?\" \"Question?\"\r\nEnd_Procedure\r\n<\/pre>\n\n\t\t<div class='author-shortcodes'>\n\t\t\t<div class='author-inner'>\n\t\t\t\t<div class='author-image'>\n\t\t\t<img src='http:\/\/salzlechner.com\/dev\/wp-content\/uploads\/sites\/2\/2016\/02\/mike5crop-566174_60x60.jpg' alt='' \/>\n\t\t\t<div class='author-overlay'><\/div>\n\t\t<\/div> \n\t\t<div class='author-info'>\n\t\t\tMichael Salzlechner is the CEO of StarZen Technologies, Inc.<\/p>\n<p>He was part of the Windows Team at Data Access Worldwide that created the DataFlex for Windows Product before joining <a href=\"http:\/\/starzen.com\">StarZen Technologies<\/a>. StarZen Technologies provides consulting services as well as custom Application development and third party products specifically for DataFlex developers<\/p>\n\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article shows how to use the SetActionMode feature in DataFlex WebApp to support wait dialogs and cursors<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","ngg_post_thumbnail":0,"footnotes":""},"categories":[27],"tags":[],"class_list":["post-257","post","type-post","status-publish","format-standard","hentry","category-dataflex-webapp"],"_links":{"self":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts\/257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/comments?post=257"}],"version-history":[{"count":2,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts\/257\/revisions"}],"predecessor-version":[{"id":260,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts\/257\/revisions\/260"}],"wp:attachment":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/media?parent=257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/categories?post=257"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/tags?post=257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}