Tutorials to .com

Tutorials to .com » Software » Power-builder » PowerBuilder data window in the general methods Print Preview

PowerBuilder data window in the general methods Print Preview

Print View , by: iSee ,Total views: 42 ,Word Count: 1051 ,Date: Tue, 21 Apr 2009 Time: 12:20 PM


We are in the process of word-processing, often before the print preview, print to control the effect, particularly in the print data must be selected in the print pages, but also the need to preview. Procedural PowerBuilder development processes to provide the data in the print preview, the following procedure describes the application of common methods to achieve print preview. Schematic diagram of the main window as follows:

Print Preview window to preview the custom size by 30% 50% 100% 200% scale

236245__1.gif

A window above the control W_preview Description:
1. Command button control (CommandButton)
Cb_1: for data window to switch to the Home.
Cb_2: flip up the window for data.
Cb_3: page down for the data window.
Cb_4: for data window to switch to the last page.
Cb_5: used to close the Print Preview window of data.
2. Check box control (CheckBox)
Cbx_1: used to add the preview window show the benchmark data.
3. Editor control mask (EditMask)
Em_1: used to display and change the relative proportions of Print Preview.
4. Group box control (GroupBox)
Gb_1: a set of controls used to display the common attribute information.
5. Radio button controls (RadioButton)
Rb_1: for user-defined print preview shows that the proportion of.
Rb_2: user settings for the Print Preview shows that the ratio of 30%.
Rb_3: user settings for the Print Preview shows that the ratio of 50%.
Rb_4: user settings for the Print Preview shows that the ratio was 100%.
Rb_5: user settings for the Print Preview shows that the ratio of 200%.
6. DataWindow control (DataWindow)
dw_1: Print preview of results to display.

Second, below the window on the realization of the creation of the above-mentioned process:
1. Create a new window W_preview, set the window type (WindowType) for the Response, set the window title (Title) for the "Print Preview window."
2. In the main window by placing all control diagram for the mask editor (Em_1) the definition of attributes defined in the General page for the Text "100", in the Mask page definition for the Mask "###", selected for Spin Control , Spin Increment set to "1", set the Min to Spin Range of "1", Max as "200."
3. Create a structure for the window s_preview, concrete steps are: points in the toolbar PowerBar check the structure of the brush (Structure), in the "opt-structure (Select Structure)" dialog box, click "New" button, a window into the structure of the definition of structural members Name (Variable Name), type "dw_name", in the structure of the type (Type) select "String", to "s_preview" for the object name to save this structure.
4. Definition for the window Open event w_preview procedures are as follows:
s_preview preview_parm
preview_parm = Message.Powerobjectparm
dw_1.Dataobject = preview_parm.dw_name
dw_1.Settransobject (SQLCA)
dw_1.Objectwindow.Print.Preview = "yes"
5. Editor for the mask (Em_1) the definition of two user events (User Events), the second incident and user_change name user_room, events user_change logo for the event pbm_enchange, it is in the editor when the trigger changes the value of the incident events user_room logo for pbm_custom01, it is called in the user TriggerEvent () function to trigger, the following events to introduce these two procedures.
user_change incident as follows:
IF Integer (This.Text)> 0 And Integer (This.Text) <= 200 THEN
Dw_1.Object.Datawindow.Print.Preview.Zoom = Integer (This.Text)
END IF
Rb_1.Checked = True
user_room incident as follows:
IF Integer (This.Text)> 0 And Integer (This.Text) <= 200 THEN
Dw_1.Object.Datawindow.Print.Preview.Zoom = Integer (This.Text)
END IF
6. Rb_2 radio button Clicked event of the procedures are as follows:
Em_1.Text = "30"
Em_1.TriggerEvent ( "user_room")
7. Rb_3 radio button Clicked event of the procedures are as follows:
Em_1.Text = "50"
Em_1.TriggerEvent ( "user_room")
8. Rb_4 radio button Clicked event of the procedures are as follows:
Em_1.Text = "100"
Em_1.TriggerEvent ( "user_room")
9. Rb_5 radio button Clicked event of the procedures are as follows:
Em_1.Text = "200"
Em_1.TriggerEvent ( "user_room")
10. Cbx_1 box Clicked event of the procedures are as follows:
IF Cbx_1.Checked = TRUE THEN
Dw_1.Object.Datawindow.Print.Preview.Rulers = "yes"
ELSE
Dw_1.Object.Datawindow.Print.Preview.Rulers = "no"
END IF
11. Cb_1 command button Clicked event of the procedures are as follows:
Dw_1.ScrollToRow (0) / / switch to the Home
12. Cb_2 command button Clicked event of the procedures are as follows:
Dw_1.ScrollPriorPage () / / switch to the previous page
13. Cb_3 command button Clicked event of the procedures are as follows:
Dw_1.ScrollNextPage () / / switch to the following page
14. Cb_4 command button Clicked event of the procedures are as follows:
Dw_1.ScrollToRow (999999999) / / switch to the Last Page
15. Cb_5 command button Clicked event of the procedures are as follows:
Close (Parent) / / from the Print Preview
16. W_preview for the window in the name of preservation of the above-mentioned window.

Third, call the above-mentioned general-purpose print preview window (w_preview)
Preview the data was the general data window window may also be a composite data window, based on the assumption that the data preview window for Dw_2, use the following method call:
s_preview ls_parm
ls_parm.dw_name = "temp.psr"
dw_2.Saveas ( "temp.psr", PSREPORT!, True)
OpenWithParm (w_preview, ls_parm)



Power Builder Tutorial Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.