{"id":1437,"date":"2012-07-12T17:56:26","date_gmt":"2012-07-12T22:56:26","guid":{"rendered":"http:\/\/anvil-of-time.com\/wordpress\/?p=1437"},"modified":"2021-03-11T12:34:46","modified_gmt":"2021-03-11T17:34:46","slug":"powerbuilder-gotcha-syntaxfromsql-and-system-fonts","status":"publish","type":"post","link":"https:\/\/anvil-of-time.com\/powerbuilder\/powerbuilder-gotcha-syntaxfromsql-and-system-fonts\/","title":{"rendered":"PowerBuilder &#8216;Gotcha&#8217; &#8211; SyntaxFromSql and System Fonts"},"content":{"rendered":"<p>So a user of an application I work on is getting an error when opening a window which contains a dynamic datawindow.  The open process reads a table and then dynamically creates a grid datawindowobject with the same number of columns as the data which is retrieved from the table.  The process itself uses the datawindow syntax created from a SQL string and a presentation string via a SyntaxFromSql call and then a DW.Create call.  In this <strong>one<\/strong> users case the process is returning a cryptic &#8220;datawindow release number is incorrect&#8221; message from the create.<\/p>\n<p>Ah Ha!  The user is running a Windows 7 workstation.<br \/>\nAh Ha!  The user doesn&#8217;t have the correct SQL Server native driver.<br \/>\nAh Ha!  The user has older PB runtime DLLs.<\/p>\n<p>Nope, another Windows 7 workstation runs fine.<br \/>\nNope, the driver is the same.<br \/>\nNope, the runtimes are correct.<\/p>\n<p>After setting up the window to create a text file containing the specific strings used to create the datawindow I see that a replace I am doing after it is generated by the SyntaxFromSql but prior to the Create is jumbling up the string.  Now the reason it is jumbling it up is I assumed the value I was looking for was a static value and since the Pos method couldn&#8217;t find the proper place it came back with zero which tells the replace to start at the beginning of the string and screwed up the Release number.<\/p>\n<p>I noticed a number of positional\/size parameters were different in the two sets of files as well.<\/p>\n<p>In Windows XP:<\/p>\n<pre> release 12.5;\n datawindow(units=1 timer_interval=0 color=16777215\n processing=1 print.margin.bottom=24 print.margin.left=24\n print.margin.right=24 print.margin.top=24...<\/pre>\n<p>In Windows 7:<\/p>\n<pre> release 12.5;\n datawindow(units=1 timer_interval=0 color=16777215\n processing=1 print.margin.bottom=30 print.margin.left=30\n print.margin.right=30 print.margin.top=30...<\/pre>\n<p>Notice the difference in the print.margin settings.<\/p>\n<p>The datawindow presentation style is:<\/p>\n<pre> &quot;style( type=Grid              &amp;\n       Horizontal_spread = 25 )      &amp;\n       datawindow( units=1           &amp;\n       Color= 16777215)              &amp;\n       column( Font.Face=&#039;Arial&#039;     &amp;\n           Font.Height=-9            &amp;\n           Font.Weight=400)          &amp;\n           text(   Font.Face=&#039;Arial&#039; &amp;\n           Font.Height=-9            &amp;\n           Font.Weight=400           &amp;\n               Border=6)&quot;<\/pre>\n<p>Which got me thinking about the font on the individual machines.<\/p>\n<p>A post to the Sybase Powerbuilder Datawindow forum gave me the following:<\/p>\n<p><em>Hi Matt;<\/em><\/p>\n<p><em>   I suspect you are correct when you say that the fonts are different.<\/p>\n<p>The reason I say that is because the DWO settings for size &amp;<br \/>\ndisplacement are set by the DW Painter. The DW Painter gets these at<br \/>\nregeneration \/ save time by using the IDE&#8217;s font settings. These in turn<br \/>\nare governed by the O\/S&#8217;s &#8220;Default Printer&#8221;.<\/p>\n<p>So, unless the XP and W7 PC are using the same default printer (and I am<br \/>\ntalking about pointing to the exact network printer instance ) and have<br \/>\nthe same recent printer font definitions installed (aka print driver<br \/>\nversion) &#8211; then these type of minor variations would surface.<\/p>\n<p>Now, when your PB application uses a SyntaxFromSQL () command, the same<br \/>\ndefault printer and font criteria is in play as if you were using the DW<br \/>\nPainter inside the IDE.<\/p>\n<p>HTH<\/p>\n<p><\/em><em>&#8212;<br \/>\nRegards &#8230; Chris<br \/>\nPresident: OSUG \/ STD Inc.<br \/>\nVice President: ISUG<br \/>\nBlog: <a href=\"http:\/\/chrispollach.blogspot.com\" target=\"_blank\" rel=\"noopener\">http:\/\/chrispollach.blogspot.com<\/a><br \/>\nSourceForge: <a href=\"http:\/\/sourceforge.net\/projects\/stdfndclass\" target=\"_blank\" rel=\"noopener\">http:\/\/sourceforge.net\/projects\/stdfndclass<\/a><br \/>\nPBDJ: <a href=\"http:\/\/chrispollach.sys-con.com\" target=\"_blank\" rel=\"noopener\">http:\/\/chrispollach.sys-con.com<\/a><\/em><\/p>\n<p>Thanks to Chris Pollach.<\/p>\n<p>The &#8216;moral&#8217; to this is you should explicitly set the various properties of the datawindow object after the create if you need to ensure a specific positional value is required to account for differences in user environments.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So a user of an application I work on is getting an error when opening a window which contains a dynamic datawindow. The open process reads a table and then dynamically creates a grid datawindowobject with the same number of columns as the data which is retrieved from the table. The process itself uses the&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,10],"tags":[21,12,16,59],"_links":{"self":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/1437"}],"collection":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/comments?post=1437"}],"version-history":[{"count":8,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/1437\/revisions"}],"predecessor-version":[{"id":2046,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/1437\/revisions\/2046"}],"wp:attachment":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/media?parent=1437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/categories?post=1437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/tags?post=1437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}