Ah, you finally gotten the time to refactor some code or maybe even clean up some proof of concept to move it into an actual application and now it’s time to make the stuff more ‘Object Oriented’. You look in your Open method and it’s full of various stuff. You create a new method to…
You are currently browsing the PowerBuilder category
PowerBuilder ‘Gotcha’ – Autoscript and Clipboard
PowerBuilder – Adding a Structure to an NVO
It is possible to define a structure within an non-visual object. You can view/ or edit the source of the nvo and insert the structure definition directly: global type nvo_case from nonvisualobject end type type str_test from structure within nvo_case end type end forward type str_test from structure string as_parm1 string as_parm2 end type global…
PowerBuilder – Add /Remove a Font at Runtime
Here is a way to add (and remove) a font to the user’s machine at runtime. You can also use this to check if a user has a particular font installed since the code also shows how to list all the installed fonts (need MS Word for this). Way back in my PB5 days I…
PowerBuilder ‘Gotcha’ – Window Hangs when Opened
So your working on some prototype for a proof of concept and are banging away at your code. Cut paste, snip, add error checking for just one case, add another control, etc., etc., and etc. You run the application, your window loads, and then things hang. You check the code, you check the database, you…
PowerBuilder – Next Key Service
As an extension of the next key stored procedure article, here is a pretty easy to implement a next surrogate key service to use with the PFC. If you don’t use the PFC it is still fairly easy to use with some modification. You can use this service anytime you want to get a sequential…
PowerBuilder – Move Frequently Chosen Items to Top of DropDownDataWindow
I’m looking at an application which basically records demographic information for a population. One of the fields listed is ‘primary language’ which has a typical dropdowndatawindow interface. I look at the options and BAM!, a huge alphabetical list (including Esperanto!). Now this application is generally used in the US so my guess is at least…
PowerBuilder – Locating Windows folders
Here is an easy way to find the paths to the various Windows folders. oleobject lole_wshell lole_wshell = create oleobject lole_wshell.connecttonewobject( "wscript.shell") is_mydocspath = lole_wshell.SpecialFolders("MyDocuments") IF IsValid(lole_wshell) THEN Destroy lole_wshell /* other folders: AllUsersDesktop AllUsersStartMenu AllUsersPrograms AllUsersStartup Desktop Favorites Fonts MyDocuments NetHood PrintHood Programs Recent SendTo StartMenu Startup Templates */
PowerBuilder – Prevent Individual Column Resizing in Grid DW
Many applications I’ve worked on have grid datawindows that include columns which display graphics to indicate some sort of common functionality such as code inquiry, row selection indicator, etc. Generally you set the ‘display as bitmap’ property on the column and go from there. The problem with these columns, however, is if the user resizes…
PowerBuilder – Get Color Value of Pixel under Pointer
Here is a sample application which will give you the color value of the pixel the user clicked on on a picture control (this can be used for any object inherited from a dragobject). To see the list of draggable controls, open the Browser. All the objects in the hierarchy below dragobject are draggable. This…
PowerBuilder – Have Window Stay on Top
One common application technique is to have any notification windows stay on top of all others, even if subsequent windows are opened on top of them (and the notification window loses focus). This can easily be achieved via an external API call: SetWindowPos. From the MSDN: “Changes the size, position, and Z order of a…