Site hosted by Angelfire.com: Build your free website today!

 

PowerBuilder - Problems and Solutions


PowerBuilder Developer Journal Articles of Interest :

Link : Resizable Response windows

Compatibility of PB 8.0.2 on Win XP - Windows Titlebar

This has nothing to do with PFC.

Microsoft has increased the default title bar height on Windows XP. The function below calculates the difference in PBUs between the current titlebar height and the standard height.

Just add the result to the window's height in the open event.

Function integer GetSystemMetrics ( int nIndex ) Library "user32.dll"

CONSTANT Integer SM_CYCAPTION = 4

Integer li_pixels, li_pbunits, li_diff

li_pixels = GetSystemMetrics(SM_CYCAPTION)

li_pbunits = PixelsToUnits(li_pixels, YPixelsToUnits!)

li_diff = li_pbunits - 76

Return li_diff

ItemChanged Not Firing

Bringing a window to the Foreground

Link : Minimizing a PowerBuilder application to the SysTray ( Approach 1 )

Link : Minimizing a PowerBuilder application to the SysTray - Source Code Only ( Approach 2 )

Link : Using the Microsoft Browser control with PowerBuilder

Link : Triggering the Print Screen Key and Other Keys Dynamically (functionally similar to VB's SendKeys)

Link : Quicken-style incremental dropdown searches

Link : Tracking down GPFs - Potential Causes

Link : Control-Tab doesn't change to the next tabpage

Link : How-to Create an External Datawindow at Runtime

Problem : of_CheckRequired / FindRequired and Checkboxes

Summary :

Hey,

I just wanted to send out a quick note regarding an issue that Jared and I ran into recently with Maintenance.  A checkbox on a datawindow was causing a pfc_Validation "Required" msg to fire even though the column was Nullable.  Inside the guts of the pfc_Validation logic, it uses the FindRequired method on datawindows.  The FindRequired method returns an error whenever a Required row/column is null, but marked as required via the Required property.  When a column is using the Checkbox Edit format, this property is not even defined.  However, FindRequired treats it as if it does, and that it is marked as TRUE.

My newsgroup posting : 

Not really. Checkbox is ALWAYS required, so make sure that you assign 
.initial values to them in datawindow painter and NVL (or whatever mechanism 
your DBMS supports) them in the SELECT statements of your dataobjects...

-- 
This is a FAQ, read Help, then search 
www.groups.google.com/advanced_group_search

pbm_thisusuallydoesnothelp:-))
Philip Salgannik

"Jason Vogel"  wrote in message 
news:419be965$1@forums-1-dub...

>I recently ran into an issue with PFC of_CheckRequired method.  It was 
>returned a PfcValidation Error on a null checkbox.  The problem that I have 
>is that the ".Required" property is not even defined for a checkbox.  So 
>why does FindRequired even look at check boxes....  shouldn't the checkbox 
>column just have been skipped.
>
> Jason 

 

Link : Automatically Incrementing Build Numbers

Problem : How can I invoke a procedure that is in an Oracle Package?

Solution :

You need to set the List Package Subprograms on the profile db connection on the System tab. (Starts in PB8)

PBNoCatalog=1

Problem : How to turn of the Catalog creation dialog

Solution :

To prevent their creation, add (or modify) the following line in the PB.INI file

PBNoCatalog=1

Problem : Double Toolbar

Solution :

double toolbar application

lapp_obj

lapp_obj = GetApplication() 
lapp_obj.ToolbarFrameTitle = 'whatever'
lapp_obj.ToolbarSheetTitle = lapp_obj.ToolbarFrameTitle  

The last line is the key here; having the same name causes the sheet toolbar to replace the frame toolbar.

If you use PFC, this happens automatically.

Problem : How to Open a PSF (Powersoft Report file) at run-time?

Solution : Set the datawindow control's dataobject to the psr filename.

   dw_1.dataobject = "mysavedreport.psr"

See Viewing a PSR file from within a Browser

Problem : How is a Null value handled in an IF condition?  Using the code below what happens if ll_contract_id is NULL?  

	ll_contract_id = lds_fulfillment.GetItemNumber(i,"contract_id")

	If (NOT (ll_contract_id > 0)) Then
	   ll_contract_id = SQLCA.of_get_sequence_nextval("contract_id_seq")
	   lds_fulfillment.SetItem(i,"contract_id",ll_contract_id)
	End If

Solution : It is easy to assume that NULL is not greater than 0, and thus the IF condition will hold true.  Wrong.  NULL fails in all comparisons.  You have to watch out for this.  Correct the above code to look like :

	ll_contract_id = lds_fulfillment.GetItemNumber(i,"contract_id")

	If IsNull(ll_contract_id ) or (NOT (ll_contract_id > 0)) Then
	   ll_contract_id = SQLCA.of_get_sequence_nextval("contract_id_seq")
	   lds_fulfillment.SetItem(i,"contract_id",ll_contract_id)
	End If

Problem : Login window going behind application (appears to disappear).

Solution : Although it's not a proper fix, you could always try setting the login window to be a "Topmost" window witha call to setPosition.

	w_login.SetPosition(TopMost!)

Problem : My SetFilter call is failing against my DateTime column.

Solution : I couldn't get SetFilter to work normally against my DateTime column.  After I reviewed code in the InfoBase, I was able to get the following code to work.

	ls_filter = "effective_date >= DateTime(~""+String(Date(SQLCA.of_getsysdate()),'m-d-yyyy hh:mm:00.0')+"~")"
	li_return_code = lds_listing_dates.SetFilter(ls_filter)
	...

Problem : My GetRow() fails even though I am calling SetRow(), SelectRow(),...

Solution : I ran into a case recently that if the datawindow doesn't contain any editable fields (ala tabstops) or all the fields are protected, then the SetRow call is actually failing and thus the GetRow returns 0.

How to do you configure your distributed PowerBuilder to run as an NT Service?

How do you add the application's compilation date to its "About" box?

How-To : Getting the display value of a DropDown DataWindow

You can get the display value out of a DropDown DataWindow by using the following code example:

	ls_value = dw_1.Describe("Evaluate('LookUpDisplay(column_name)', " + String(row_number) + ")") 

GetItem() will return the data value from the column, not the value that the user actually sees.

How-To : Get the name of the child datawindow by using dot notation as follows :

	String     ls_name

	ls_name = <datawindow_control_name>.OBJECT.<col_name>.DDDW.Name

You can also get the displaycolumn and datacolumn in a similar fashion :

	<datawindow_control_name>.OBJECT.<columnname>.DDDW.Displaycolumn
	<datawindow_control_name>.OBJECT.<columnname>.DDDW.Datacolumn