Schultz’s PowerBuilder Notes

Making DW Radio Buttons and Check Boxes look disabled


An effective GUI quickly communicates to the users  how they can interact with the current window.  For most datawindow edit styles, PowerBuilder supplies its developers with the means to visually show if  it is available to accept user input.  Unfortunately, if you are working with an older version of PB,  how to show  a disabled check box or a radio button is a  puzzle.  Here is how I deal with this issue.

Continue reading

Advertisements

March 17, 2009 Posted by | 2. Datawindows, Datawindow PowerScript, Expressions, Modify and Describe | , , , , , , , , , , , | 9 Comments

The Ol’ Hidden Items in the Dddw Problem Part II


We all eventually need to build a datawindow where the contents of a drop down list is dependent on the value of another column.

Filtering the available selections in the dddw for the current row is straight forward, just add the necessary filtering script in the RowFocusChanged and ItemChanged events.   (See DDDW Contents Based on the Value of Another Column for more information regarding this. ) But if you have a tabular view, problems may soon become apparent with dependent columns in some rows displaying code values instead of descriptions.

Continue reading

November 16, 2008 Posted by | Drop Down Data Window (DDDW) | , , , , , , , , , , , | 9 Comments

PFC Security Q and A


How do I enable the PFC security service?

A common place to do this the pfc_postopen event of w_frame

gnv_app.of_SetSecurity(True) //Enable security service

How do I force security to run on a particular object

Continue reading

July 21, 2008 Posted by | 3. PFC, Utility Services | , , , , | Leave a comment

PFC DataWindow Sort Service


The sort service provides enhanced datawindow sorting capabilities, including an
end -user interface. It includes the following features:

Continue reading

July 10, 2008 Posted by | 3. PFC, Datawindow Services | , , , , , , , | 1 Comment

DataWindow Script Techniques


How do I set a property for an entire column?

Modify(“shft_id.visible = 0”)

Modify(“shft_desc.protect = 1”)

Continue reading

May 26, 2008 Posted by | 2. Datawindows, Datawindow PowerScript | , , , , , , , , , , , , , , , , , , , , , , , , , , , | 8 Comments

More Modify and Describe


How do I change the contents of a text field?

Continue reading

May 22, 2008 Posted by | Modify and Describe | , , , , , , , , , , , , | Leave a comment

DDDW Contents Based on the Value of Another Column


The Problem

The contents of a particular drop down datawindow (dddw) depends on the value of another column. In the example, Version No is a drop down data window whose contents depend on the value of Tool Name. Version No will be a dddw child. Many books use retrieval arguments, but Andy Kempen showed me a way of using filter to avoid the additional database traffic. Note, this example assumes that the Code Value and the Display Value of the DDDW are the same. If they are different you will have another problem which will be addressed in another post

dddw-pic11

  • When the datawindow is retrieved, the entire contents of the dddw child must also be retrieved. In the ue_retrieve event:
// override ancestor

datawindowchild dwc
string          ls_tool_name

this.GetChild("version_no", dwc)
dwc.SetTransObject(SQLCA)
dwc.Retrieve( )

this.SetTransObject(SQLCA)
IF this.Retrieve(il_uo_seq_no) < 0 THEN
   IF SQLCA.SQLCode < 0 THEN
      MessageBox("&#91;1&#93;uo_dw@ue_retrieve",  SQLCA.SQLErrText, stopsign!)
   END IF
END IF

IF This.GetRow( ) = 0 THEN
   this.Event ue_insert( )
END IF&#91;/sourcecode&#93;
<ul>
	<li><!--&#91;if !supportLists&#93;--><span style="font-family:Symbol;"><span>I</span></span>f the user selects a different row, the column which drives the DDDW child may change, so the contents of the DDDW child will have to be updated.<span> </span>In the <strong>RowFocusChanged</strong> event:</li>
</ul>
datawindowchild  dwc
string           ls_tool_name

this.GetChild("version_no", dwc)
ls_tool_name = this.GetItemString ( currentrow, "tool_name" )
IF IsNull(ls_tool_name) THEN
   ls_tool_name = ""
END IF
dwc.SetFilter("tool_name = '" + ls_tool_name + "'" )
dwc.Filter( )

If the column which drives the DDDW child changes, the contents of the DDDW child will also have to change. So in the ItemChanged event:

datawindowchild dwc
string          ls_tool_name,ls_null

IsNull(ls_null)

IF Upper(getcolumnname( )) = "TOOL_NAME" THEN
   this.GetChild("version_no", dwc)
   ls_tool_name = data
   dwc.SetFilter("tool_name = '" + ls_tool_name +"'" )
   dwc.Filter( )
   SetItem(row, "version_no", ls_null)
end if
  • If a new row is inserted, the dwc should not have any rows as the tool_name column is empty. Script in the ue_insert event:
datawindowchild   dwc
decimal           ld_seq_num
integer           li_rc
string            ls_tool_name, ls_null

ld_seq_num = il_uo_seq_no
li_rc = this.SetItem ( this.GetRow( ), "SEQ_NO" , ld_seq_num )

IsNull(ls_null)
IF Upper(getcolumnname( )) = "TOOL_NAME" THEN
   this.GetChild("version_no", dwc)
   dwc.SetFilter("tool_name = '" + ls_null + "'" )
   dwc.Filter( )
END IF

May 10, 2008 Posted by | Drop Down Data Window (DDDW) | , , , , , , | 2 Comments

Column Properties


Display Properties (Masks)

! Upper Case
^ Lower Case
a Alphanumeric
x Any character
# Number

Continue reading

May 9, 2008 Posted by | 2. Datawindows, Datawindow Painter | , , , , , , , , , , , , , , | Leave a comment

Column Display


How do I get my field to appear like a MLE and word wrap?

  • In the datawindow painter, select the column
  • Properties
  • EDIT tab

Check AUTO VERT SCROLL and AUTOSELECTION. Other selected items may also work, however do not select HORZ SCROLL BAR. When I update a column, the change is applied to the database for many rows, not just the current one.

Check the unique Key Column in the DataWindow’s Update properties dialog box. Click the Primary Key button to assure that the columns selected are indeed unique.

Okay, in a datawindow, how do you get rid of displaying the time portion of the date field?

In the DataWindow painter, select the field and change the format property

Graying out a checkbox

If a checkbox has 3 states, and it’s state is set to that 3rd state (other), then a gray checkmark will appear in the checkbox instead of a black one.

So, by changing the state of checkbox to that 3rd state, and protecting it, it will appear to be grayed out.

May 9, 2008 Posted by | 2. Datawindows, Datawindow Painter | , , , , , , , , , , , , , | 1 Comment