Beruflich Dokumente
Kultur Dokumente
mle_sfs.Text = error_syntaxfromSQL
mle_create.Text = error_create
END IF
END IF
dw_new.SetTransObject (SQLCA)
dw_new.Retrieve ()
int i
for i = 1 to 3
Open (newarray [i], win [i])
next
ShellAboutA (handle (parent), "About ... # ferryman studio", "Welcome to the ferryman studio", 0)
// How COLUMN display style between EDIT, DDDW, DDLB switch between:
dataStore lds_ds
lds_ds.dataObject = dw_1.dataObject
end if
next
lds_ds.print ()
sb_interrupt = false
for n = 1 to 3000
yield ()
value if sb_interrupt then // sb_interrupt modifications to true in the "Cancel" button in the Clicked
event
sb_interrupt = false
exit
else // other processing, display the current value of n in a single line editor
end if
next
// SQL statement calling convention
INTEGER li_customer_id = 1
PREPARE SQLSA FROM "DELETE bb_customer_info_t WHERE city_code = AND customer_id = ";
SELECT department.dept_id,
department.dept_name,
employee.emp_id,
employee.emp_fname,
employee.emp_lname
2, set the data window d_grid_dep_emp properties of the column taborder to non-zero value; and click
on the menu Rows -> Update
Properties, set this data window Allow Updates, Table to Update to department, Updateable Columns of
department.dept_id, department.dept_name.
3, update the data window button in the window clicked event scripting:
long ll_rtn
If ll_rtn = 1 then
// Close modifications to the Department table
ll_rtn = dw_1.Update ()
IF ll_rtn = 1 THEN
dw_1.retrieve ()
ELSE
END IF
END IF
getfocus event write code: this.selecttext (1, len (this.text)). Save running, do not get what we want
Effect. Think of an alternative approach: to pbm_bnclicked for the event ID, create a single-line edit box
custom event ue_clicked,
code getfocus event changed: This.Post Event ue_clicked (). After the save operation, the effect came
out!
li_num ++
i=i+1
End if
Next
Char lc_sort
IF Right (dwo.Name, 2) = '_t' THEN // made whether the column header name
lc_sort = 'D'
ELSE
lc_sort = 'A'
END IF
ELSE
this.SetSort (ls_criteria)
END IF
this.Sort ()
END IF
line int il_last_row // il_last_row for instance variables, recording the last click
if row = 0 then
return
else
li_current_row = row
end if
if keydown (keyshift!) then // press the SHIFT key
if il_last_row = 0 then
il_last_row = li_current_row
else
end for
else
end for
end if
end if
il_last_row = li_current_row
else
end if
end if
end if
// DW queries change conditional statements
ls_select = dw_1.getSqlSelect ()
dw_1.Reset ()
dw_1.SetTransObject (SQLCA)
dw_1.SetSQLSelect (ls_select)
dw_1.Retrieve ()
dw_1.AcceptText ()
CHOOSE CASE MessageBox ("Operation Tips", "data has been changed, whether to save ", Question!,
YesNoCancel!, 1)
CASE 1
cb_save.TriggerEvent (clicked!)
CASE 2
CASE 3
END CHOOSE
END IF
// Tip: Select to delete records
return
end if
// Sorted by a field
this.sort ()
this.sort ()
END IF
An increase in Datawindow a computational domain, named: ceil_page, the computational domain must
be placed Detail section,
Expression enter ceiling (getrow () / 25) 25 25 rows per page said, it can be a parameter.
By ceil_page grouping, and select New Page On Group Break (meaning began to change when a new set
of pages).
3, this computational domain is set to hide (in the properties page expression pages written in the visible
attributes 0).
li_count = dw_1.retrieve ()
if mod (li_count, 25) <> 0 then
dw_1.insertrow (0)
next
end if
2) Double-click the mouse on a column in the need to set up automatic fold line, bounced off the
Properties window for this column.
4) Select the Edit tab and uncheck Auto Horz Scroll checkbox.
6) points Detail Band (ie write long belt Detail gray), and click the right mouse button and select
Properties ... menu item.
Note: The characters together (with no punctuation or spaces), the system will be considered as a word,
does not automatically wrap,
English is also true ...... DW window wrap if there are characters, then it will be necessary to wrap the
intermediate spaces, otherwise how to set up will not work. For example, you
If you want to fold in the first 20 rows, you first determine whether it is the first 20 characters, if not to
put a space after the first 20, if the characters in the
The first 19 spaces. Determine whether the characters in the ASCII code can use it to determine whether
it is greater than 127.
case (cj when is> = 90 then rgb (255,0,0) when is <60 then rgb (0,255,0) else rgb (0,0,255)))
// PB simultaneously connect to multiple databases, such as connecting SQLServer2000 and Oracle8
string ls_startupfile
ls_startupfile = 'hisini.ini'
// Attached hisini.ini
[Database]
Database = his
UserId =
DatabasePassword =
ServerName =.
LogId = sa
Lock =
Prompt = 0
ocx = 0
cfprint = '1'
[Database_remote]
ServerName = "oracle8"
LogId = "dba"
Database = zx
UserId =
DatabasePassword =
Lock =
Prompt = 0
ocx = 0
cfprint = '1'
SQLCA.LogPass = "test"
SQLCA.ServerName = "myora"
SQLCA.LogId = "test"
SQLCA.AutoCommit = False
dataWindowChild dwc
dwc.settransobject (sqlca)
dwc.retrieve ()
dwc.insertrow (1)
dw_service.setTransObject (sqlca)
dw_service.Retrieve ()
// Data window, press the enter key to achieve tab function (in Enter event data window)
return 1
cb_OK.TriggerEvent (Clicked!)
ls_accept_city = gs_citycode
end if
return
end if
af_connect ()
dw_wp.settransobject (sqlca)
af_disconnect ()
// PB standard sql statement calling
end if
close cur_get;
do while sqlca.sqlcode = 0
ll_sqlcode = sqlca.sqlcode
CLOSE cur_sql;
af_disconnect ()
return
exit
end if
ddlb_register_number.additem (trim (ls_register_number + '|' + ls_complete_note))
loop
CLOSE cur_sql;
af_center_window (this)
af_connect ()
// Define variables
dataWindowChild dwc
dwc.setTransObject (sqlca)
dw_city_code.setTransObject (sqlca)
dw_city_code.Retrieve ()
dwc.setTransObject (sqlca)
dwc.Retrieve ()
dw_service_kind.setTransObject (sqlca)
dw_service_kind.Retrieve ()
dwc.setTransObject (sqlca)
dwc.Retrieve (ii_service_kind)
dw_apply_event.setTransObject (sqlca)
dw_apply_event.Retrieve ()
cb_query.TriggerEvent (clicked!)
af_disconnect ()
af_connect ()
// Define variables
dataWindowChild dwc
dw_1.setTransObject (sqlca)
dw_1.Retrieve (ii_service_kind)
dwc.setTransObject (sqlca)
dwc.Retrieve (ii_service_kind)
dw_2.setRowFocusIndicator (hand!)
dw_2.setTransObject (sqlca)
// If you do not retrieve the data into a blank line, the data on filter
string ls_filter
int li_action
if li_row_temp = 0 then
dw_2.insertRow (0)
else
dw_1.setFilter (ls_filter)
dw_1.filter ()
next
end if
af_disconnect ()
// Variable definitions
MessageBox ('prompt', 'Please select the record you want to add!', Exclamation!)
return
end if
// Add information
dw_2.scrollToRow (li_row)
IF dw_2.GetRow () = 0 THEN
Return
ELSE
IF MessageBox ("message", "really want to delete the specified record ", Question!, YesNo!, 2) = 2 THEN
Return
END IF
af_connect ()
// Define variables
dataWindowChild dwc
MessageBox ("Operation Tips", "data does not change, no need to save!", Exclamation!)
return
END IF
dw_2.sort ()
MessageBox ('operating tips', 'step can not be blank or zero, please re-enter!', Exclamation!)
dw_2.setRow (li_row)
Return
END IF
NEXT
// Save
dw_2.SetTransObject (sqlca)
if dw_2.update () = 1 then
commit;
else
ls_error = sqlca.sqlErrText
rollback;
return
end if
if PrintSetup () = -1 then
return
else
if dw_1.print (true) = 1 then // can cancel the print dialog box is displayed
else
end if
end if
else
Messagebox ('prompt', 'no data can be printed, please check the data! ", Exclamation!)
return
end if
return
end if
end if
// Import button Generic Script
// Variable definitions
long ll_buffer
// Variable assignment
ls_ext = "txt"
ls_filter = "text files (* .txt), *. txt, all files (*. *), *. *"
return
end if
sle_file_name.text = ls_pathfile
cb_ok.enabled = true
// Variable definitions
ls_accept_city = gs_citycode
ls_department = gl_dealerid
ls_oper_person = gs_workerid
af_connect ()
if sqlca.sqlcode = -1 then
ls_err_info = sqlca.sqlErrText
close proc_assign_no_repeal;
Rollback;
af_disconnect ()
return
End if
close proc_assign_no_repeal;
Rollback;
af_disconnect ()
return
end if
close proc_assign_no_repeal;
commit;
af_disconnect ()
dw_wp.print ()
If PB's ListView can not properly display Chinese, you should set the ListView's FontCharSet property into
other types. The
Export ListView where the object into the source code. Find ListView definition section in the source
code, which will FontCharSet property into
DefaultCharSet! If other controls PB corresponding phenomenon also occurs when the same
adjustments to its FontCharSet properties. General
Speaking for Simplified Chinese fonts in Chinese WINDOWS environment should be set to DefaultCharSet
!. Display Chinese control in question
It's FontChatSet property forcibly set to DefaultCharSet! Should be no problem. Or change the font !!!
Straight connector (Native Driver) or ODBC database interface connections required (ODBC Driver)
Client-side (such as Sybase's Open Client, Oracle's SQL Net) database connection required
These are Sybase's proposal.
My experience is that the compiled program must have pbdwe60.dll and pbvm60.dll job.
Also, if you need to use the ODBC database links pbodb60.dll, if you are using a dedicated interface, you
need the corresponding DLL database
exe file execution //pb6.5 upgrade to problems that may occur after 6.5.1
Re-copy \ Sybase \ pbvm60.dll Shared under (3.24M) instead of when not upgraded pbvm60.dll (3.25M)
on ok!
When you install PB65 custom installation components ODBC Databases Drives in the Sybase SQL
anywhere 5.5.04, this is just
PB components installed ODBC driver is not installed SQL ANYWHERE, if you need to use SQL Anywhere
administration tools, you
Have the following operations: Genuine PB6.5 in the sixth disc, there is a directory name is SQLANY5504,
there is SQL ANYWHERE
Installation disk, and run SETUP can. If it is pirated, it had to rely on your own to go up. In the installation
directory there is a SETUP.BMP,
// Speaking to a lot of books FILE menu midpoint CREATE DATABASE, how to make this option out
In pb sixth CD (or use the D version of the second disc \ 6 \ sqlany5504), enter sqlany5504 directory,
install sql anywhere 5.5,
The default installation path is: C: After the \ Program Files \ Sybase \ SQL Anywhere 5.0 \ win32,
installation, modification
autoexec.bat, add a line for sqlanywhere file into the system search path:
After this reboot, you can see the File menu of the Create Database more this one.
Special Note: In the ... \ This directory under win32 there is a very important document, dbtl50t.dll, you
can do an experiment, enter
PB DataBase drawing board (no exit), then switch to the File Manager will dbtl50t.dll files to rename, and
then switch back to the PB,
Point File menu, you will find this a Create Database has disappeared. The dbtl50t.dll renamed back,
back again PB Click here
File menu, everything has returned to normal. But no Create DataBase This one is not very important,
you can also use
Sybase Central to manage the database, it is a comprehensive database management tool Sql anywhere,
you can build storage procedures, triggers.
(In the "Start" -> "Programs" -> "Sybase" -> "Sql anywhere 5.0" below, in the hard disk to perform the file
name is scview.exe).
Please following files are copied to the directory where the file operation
Second, the establishment EXTRA subdirectories, copy files to the subdirectory MSVCRT.DLL
EXTRA \ MSVCRT.DLL
Sqltnsnt.dll CORE35.DLL
You can!
In the user interface design, each adding an object such as buttons, text boxes, etc., PowerBuilder will
use the default font, size, color
And other attributes to define objects. If this is not the properties we need, then we need to modify the
properties individually. You can by default
Property changes needed to simplify for this operation. Open the application brush, in the properties can
be the default font, size, color and other attributes
Conversion between numeric types automatically by the system, usually converted to high-level accuracy
based on the operator to participate in operations.
integer (str), long (str), real (str), double (str), dec (str)
string (number, format), number is any numeric type, format after format conversion instructions can
usually be omitted.
// Pronouns
this: This representative of the window, the user object, menu, application object or control itself, which
represents the object being to whom to write event handlers.
ParentWindow: ParentWindow representative runtime menu window where the pronoun used only in
the event handler menu.
super: When writing a control sub-objects or object, the child object can call the parent object's event
handler, the program can directly use
The name of the parent object to call them, can also be used to refer to Super pronouns. For example,
when you want to call the parent object's Clicked event handler,
// Relationship in PowerBuilder and RGB color values between the values as follows:
blob binary large object, used to store large amounts of data, such as images, large text, etc., such as:
blob {100} ib_test // length 100
boolean Boolean, Boolean variable has only two possible values : TRUE or FALSE
date date, including the year (1000-3000), month (01-12), 1999 (01-31)
DateTime data type datetime date and time, only for database access
dec or decimal, signed decimal number, maximum 18 precision, such as: dec {2} ld_test // 2-bit precision
string string type, ASCII characters used to store an arbitrary length of 0 to 60,000 (16 environments), 32
environment length
Limited only by the capacity of the system. When the program writes directly to the string, use single
quotation marks (') or double quotes (") to enclose the string
time 24-hour time, including the hour (00 to 23), points (00 to 59), second (00 to 59) and the second
decimal place (up to six),
Any type of any variable in order to know the type of stored data, you can use the function ClassName ()
Define a Bolb variable lb_file, the file read lb_file, with insertblob or updateblob on OK
// Variable scope
Global variables: the entire application can access, its scope is the entire application
Instance variables: the object is associated with, only be used for the object instance variables defined in
the event handler or function of the object.
Instance variables when it is associated with an object created is opened, when it is closed to disappear
Shared variables: a static variable, which means not only share when it opened again after the object is
closed object variable remains closed
Value, but also means keeping multiple instances of the same value with the same name in a class
shared variables
Local variables: the use of its event handler or function described in its scope is limited to the description
of its program segment, any segment of the program
Places can access local variables, but other programs can access this section block local variables. After
running the program, enter
When a program segment, the system automatically allocates memory for local variables, when you exit
the program segment, the memory of local variables is released.
DO ... LOOP and FOR ... NEXT loop statement, when we wanted to quit in the middle of the cycle when
the EXIT statement, control procedures
Go to the statement after the loop, in the case of nested loops, EXIT statement to exit the current level
circulation, but not all cycles.
In the body of the loop DO ... LOOP and FOR ... NEXT statement, after encountering CONTINUE
statement, after the end of the cycle does not execute CONTINUE statement
3.RETURN statement:
Return control to the user or the calling function places. (When the termination of the application you
want to run, use the HALT statement), the immediate termination of the event processing
Execution of the program or function, the control is returned to the calling program when the RETURN
statement at the event handler and a user action triggers the event
After the treatment program, the implementation of the RETURN statement, which immediately
terminates the execution of the event handler and waits for the user's next operation when the program
When calling a function or event handler, after executing the RETURN statement, which immediately
terminates execution event handler or function, and to
HALT statement is used to terminate the application to run when HALT CLOSE statement with no options,
the statement immediately terminate running applications.;
When HALT statement with CLOSE option, after execution to the statement, the application to execute
the application object Close event handler, and then re-
When we read the data from the database, all data will be placed in the main buffer (primary buffer),
and will put a copy of the original
Buffer (original buffer) within in the data window we can see the data the main buffer (primary buffer)
within any
Data processing are also doing the main buffer for data processing, but remember, no matter what we
do the data in the buffer zone of any treatment,
Unless we run the update () function, no changes to the data in the buffer, for the back-end database
without any effect.
// How to generate a fixed-length front plus zero digits, for example: 12 generation "00012" 1234
generation "01234." The method is simple:
// row represents the number of rows, col represents the field name, val represents the value
dw_1.getItemX (row, 'col') // single read data faster than dot notation
dw_1.object.data [1]
dw_1.object.data [1,2]
dwc.object.data [1,1]
dw_1.object.data [1,1,2,2]
dw_1.object.col [1]
dw_1.object.col.current
dw_2.object.data = dw_1.object.data
dw_2.object.data = dw_1.object.data.select
string ls_name []
next
// Read data
retrieve ()
// Increase data
dw_1.insertRow (row)
dw_1.deleteRow (row)
dw_1.filter ()
// Data sorting
dw_1.sort ()
// Data Clear
dw_1.reset () // remove the data from all of the buffer, but does not have any effect on the data in the
database
// Data calculation
dw_1.rowCount ()
dw_1.filteredCount ()
dw_1.deletedCount ()
// Data Status
notModified!
dataModified!
// Data copy
// Data movement
// Data rolling
dw_1.scrollToRow (row)
// dw parameter
dwo.name
// describe () function
// modify () function
dw_1.modify ("kind_t.color = '0 ~ tif (kind> 1000,255,0)'") // ~ t 0 is the default value for the previous
fileExists ()
fileRead ()
fileLength ()
fileClose ()
fileSeek ()
fileOpen ()
fileWrite ()
// Dbf format file, or text file tab key segment fields directly introduced in the data window buffer
Export data window into .srd file, use Notepad to open the processing = 1 into processing = 0
Yield () is a function not used to PowerBuilder. However, a large loop in the process, if the user wants to
perform half
By clicking a button or menu to exit, then it must use to Yield () function, otherwise the program will
complete the entire cycle will be executed after
Respond to the Click event of the button or menu. The Yield () function in the middle of the loop body.
So find that during the execution of the loop has something new
//sqlca.SQLCode
When using Embedded SQL for each SQL command you should run a check once the transaction object
attributes SQLCode, rather than wait until
All SQL command has finished running and then go run a check transaction object SQLCode properties.
When the function we use the data provided by the window, the
Do you want to remember to check SQLCode to determine whether the run was successful. But to every
function in accordance with the value of the return run to determine whether to run
Success.
if sqlca.sqlCode = -1 then
if sqlca.sqlCode = -1 then
end if
else
end if
if dw_1.update () = -1 then
else
End if
// In PB how to open a file (such as .txt, .doc), just like in Explorer, double-click to open the file the same
Function long ShellExecuteA (ulong hwnd, string lpOperation, string lpFile, & string
Call as follows:
String ls_null
SetNull (ls_null)
// Insert a row after a default value to the default value but do not modify, CloseQuery event does not
excite method
long 1_Row
// Value of a column with a data window is retrieved based on the value of another column (on
itemchanged event in DW)
dataWindowChild dwc
s_type1 = data
s_sql = "Select distinct type2 From vw_type Where type1_code =" + "'" + s_type1 + "'" // dynamically
generated SQL statements
dwc.setTransObject (sqlca)
dwc.SetSQLSelect (s_sql)
dwc.retrieve ()
end if
Rule checking data window //
When a user enters data in the edit control, the data will not be written immediately buffer the data
window until the occurrence of any of the following,
PowerBuilder DataWindow only writes data from the edit control buffer.
After completely through the four steps of rule checking, will really put data into the data buffer from
the edit control window. Error in any one step
. Would produce data window ItemError Event data rule checking step data window are as follows:
AcceptText (): write data to the data in the edit control window buffer.
Do not write Acceptext () function in Itemchanged or ItemError event because Acceptext () function may
drive
// Function Function similar event and every event, there will be arguments argument and return value
return value.
0.5 reject the value of the data, and displays a system error message (default)
Value of 1. Reject the data, but the system does not display an error message
1. Key Columns: When comparing raw data buffer and the data generated by the current database where
clause condition is not stringent enough, so in the same
A time when there are a lot of users may use the database with the changed circumstances would
someone data coverage will occur in order to
Avoid this from happening, usually we will KeyColumns way relationship with a single user or a table, all
the fields are
2.Key and Updateable Columns: because the data in the buffer and compare the original data generated
by the current database
where conditional clause is very rigorous, so in the same time, when a lot of users use the database
together, does not happen to other people
Data covering the situation changed, so we can get the maximum consistency when data is saved.
3.Key and Modified Columns: because the data in the current database generated by comparing the data
buffer where clause
Conditions more flexible (Modified to modify the current value of the field), so in the same time, when
many users use the data together
Library, the situation will be changed by others data coverage may occur.
1.Use Delete then Insert: This is the data window when you modify the main field (Key Column) is the
default option, the choice this way
When you modify the data, the data will first be deleted and then re-increase a data, but in the use of
special note is that if the relationship
Database, when designing deleted for Cascade Delete, modify data in time may result in additional data
not want to delete are deleted.
In addition, the choice of the field must select all the fields, otherwise there is no way to increase a
further weight data.
2.Use Update: This option will directly modify the value Key field, but not all of the relational database
(DBMS) provides such
Function.
ls_syntax = sqlca.syntaxFromSql ('select kind, name from tab_t', 'style (type = tabular)', ls_err1)
dw_1.setTransObject (sqlca)
dw_1.retrieve ()
1 shows a cursor with a DECLARE; (post without checking SQLCode property, to use a semicolon to end
the statement.)
4 processing data;
5 to determine whether all of the data has been read, repeat steps 3 to 5 when not reading;
int Emp_num
string Emp_name
if sqlca.sqlcode = -1 then
rollback;
return
end if
CLOSE Emp_cursor;
string Mysql
int Emp_id_var = 56
// 3. Already know the parameters and result set when compiling the column (cursor or stored
procedure)
int Emp_id_var
if sqlca.sqlcode = -1 then
rollback;
return
end if
CLOSE my_cursor;
// Or
int Emp_id_var
if sqlca.sqlcode = -1 then
ls_error = sqlca.sqlErrText
rollback;
end if
if li_flag = -1 then
rollback;
end if
CLOSE my_cursor;
// 4. Development program fashion do not know the parameters and result sets
// When the FETCH statement is executed successfully, the dynamic description area SQLDA contains the
first row of the result set data can be obtained repeatedly execute the FETCH statement
// Example TypeInteger !, or TypeString! Etc., use CHOOSE CASE statement calling for different output
parameters of different types of objects
CASE TypeString!
CASE TypeInteger!
END CHOOSE
CLOSE my_cursor;
// In addition to the DECLARE statement, executed after all other statements should check SQLCode
property transaction object, in order to determine whether the current SQL statement execution
// Successful.
dw_1.HSplitScroll = True
dw_1.Object.DataWindow.HorizontalScrollSplit = dw_1.object.id.Width
dw_1.Object.DataWindow.HorizontalScrollPosition2 = dw_1.object.id.Width
string ls_pagecount
dw_1.print ()
// Hide the taskbar method in use in the OnCreate event Window API function SetWindowLong:
SetWindowLong (Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
PB using the first declare the function FUNCTION long SetWindowLong (ulong hWnd, integer nIndex,
ulong dwNewLong) library "user32.dll" ALIAS FOR "SetWindowLongA",
// If more than 23 this month, will be the 1st time is set for next month, otherwise take the current time
// Method 1:
else
this.text = string (date (year (today ()), month (today ()) + 1,1))
end if
else
end if
// Method 2:
dateld_temp = today ()
if day (ld_temp)> 23 then ld_temp = date (year (RelativeDate (ld_temp, 10)), month (RelativeDate
(ld_temp, 10)), 1)
Version: PBVM60.dll, PBVM80.dll, PB7 I have not used, but I think there should be.
Version: PBVM60.dll, PBVM80.dll, PB7 I have not used, but I think there should be.
Open the properties listed in the Expressions, input conditions in protect the discriminant:
// Ole object, such as when using the communication with the Word, how to avoid multiple Word and
other programs to start:
OLEObject ole_object
MessageBox ('OLE Error', 'OLE unable to connect Error Number:!' + String (li_ret))
return
end if
ole_object.visible = true
END IF
Although no such controls, but there is a PowerBuilder user object in the case brought in in
PowerBuilder
uo_progress_bar able to complete the necessary requirements. The object is copied to the user's user
database application resides, place it in the user interface
Local needs arise. Then when the task progress, with uf_set_position object () function indicates the
current progress of the task.
// Call screen protection method in PB:
"Path", ls_outlook_path)
Function uLong GetModuleFileNameA (long hinstModule, Ref String lpszPath, uLong cchPath) Library
"kernel32.dll"
string ls_AppPath
int li_ret
// To compile into an executable file .exe available, otherwise get is the path of pb60.exe or PB050.exe of
Powerbuilder.
// Editing style columns dynamically set in the program for the pull-down data window
(DropDownDataWindow)
// Or:
dw_1.object.department_id.dddw.name = "d_dddw_dep"
dw_1.object.department_id.DDDW.DisplayColumn = "dept_name"
dw_1.object.department_id.DDDW.DataColumn = "dept_id"
// Note: PowerBuilder has a small tool DWSyntax (program called: dwsyn60.exe), provides access to and
modification of the data window,
The syntax of the attribute value // columns, etc., of the programming is very helpful. These scripts can
be found in DWSyntax.
// 1. Line editor for user-defined event ue_enchange, ID events is: pbm_enchange. This event can
respond to keyboard input.
long ll_found_row
string ls_find
ls_find = "string (id) like" + "'" + this.text + "%'" // search conditions (left part of the single-line text editor
equivalent)
Deleted when you delete ID is 'mm' records can be, is to insert a new ID as 'mm' records, and then writes
the data with UPDATEBLOB
Table. Other databases may reference manual, the command above is not very different!
// column_name = column name, 'a' represents the first row; look at Help the Describe
// Method one:
Message.Processed = TRUE
END IF
Long ll_ret
ll_ret = 1
END IF
return ll_ret
// Method two:
Build a instance variables in your True then close the program assigns a value judgment that closequery,
such as False then Return 1
// When the program is used in a dynamic join objects, such as BMP resource files, data window object,
PB compile time is less than the scan, the solution:
The use Notepad to create a resource file dw_object.pbr writes: c: \ myprogram.pbl (dw_sj)
This file into the Resource File Name selected at compile time.
// With the following expression can be obtained in a certain group recorded line number:
1, in the appropriate position statement functions, such as windows, the Application, UserObject inside,
Defined in the Local External Function or Global External Function, as playing sounds:
You can also create a UserObject, centralized declared common API and localization functions, such as
the definition of user objects u_external_function:
Function as follows:
uint lui_numdevs
lui_numdevs = WaveOutGetNumDevs ()
If lui_numdevs> 0 Then
return 1
Else
return -1
End If
2, the definition of an entity called in the program and call its function:
u_external_function iu_external_function
Try, if you have a sound card, you will hear a "ding" sound. Other API functions are treated as such.
// GRID format data under the window, according to the actual situation of each row to control the
background
// Adjust the properties of the color detail the expression on it, such as:
if (currentrow () = getrow (), rgb (255,240,194), if (mod (getrow (), 2) = 1, rgb (255,254,249), rgb
(247,247,239)))
// Expression rgb (255,240,194) as a yellow, rgb (255,254,249) as a pale white, rgb (247,247,239) as a
pale yellow.
// CurrentRow () to get the data window to get the input focus current line number.
// GetRow () returns the data window corresponding with the current line number.
// Achieve the data window of a column / row is displayed as a specified color
This method can also set the font color of the column: where "column_name" as the column name.
// Previous column method of fixing the data window, for example, the first column called "id", fixed the
column and started to show from the second half of the next column:
dw_1.HSplitScroll = True
dw_1.Object.DataWindow.HorizontalScrollSplit = dw_1.object.id.Width
dw_1.Object.DataWindow.HorizontalScrollPosition2 = dw_1.object.id.Width
// Hyperlink
Inet linet_base
linet_Base.HyperlinkToURL ('http://www.neusoft.com')
Destroy (linet_base)
// ================================================ ===========================
// Return value: string retVal calculated value of the expression, such as 2 * (3 + 5) result is 16
// ================================================ ===========================
string retVal
datastore lds_evaluate
destroy lds_evaluate
return retVal
By SetWindowPos function to display the level of the window changes to HWND-TOPMOST, you can
make the specified window will never be another window cover
Function Long SetWindowPos (Long hwnd, Long ord, Long x, Long y, Long dx, Long dy, Long uflag) Library
"user32"
Parameter 1 to be the top-level display window handle parameter 2 to specify the display level,
parameter 7 as an additional option, the remaining parameters specify the window position and
Size, can be ignored. Add the following function in Open or Activate event window to call:
Parameter 2 to take -1 indicates the topmost display window, take 1 represents the lowest level in the
display; If we take one last parameter, indicating that the window size remains
Variable, indicating the holder 2 to take the same position, and therefore, take 3 (= 1 + 2) indicates the
size and position remain unchanged, 0, it indicates the size of the window, and
You can get the drive through GetDriveType function (eg: floppy drive, hard disk, CD-ROM, network
mapped drives, etc.) information, the function
Declared as:
Parameters for a drive letter (such as "C:"), the return value: 1 means unknown, 2 floppy drive, three said
the local hard drive, 4 represents a network drive,
5 shows the optical drive. Therefore, the following code can get the disc drive:
End If
Next
⑴ get the current directory. You can get the current directory by GetCurrentDirectory function, which is
declared as:
Function Ulong GetCurrentDirectoryA (Ulong buflen, ref String dir) Library "kernel32.dll"
Parameter 2 to receive the current directory character buffer, ref must be added in front of said address
references; parameter 1 to length specified character buffer.
String curdir
curdir = Space (256)
⑵ get Windows and system directories. GetWindowsDirectory and GetSystemDirectory to use two
functions, subject to the following statement:
Function Uint GetWindowsDirectoryA (ref String dir, Uint buflen) Library "kernel32.dll"
Function Uint GetSystemDirectoryA (ref String dir, Uint buflen) Library "kernel32.dll"
4. How in the PB off the current user, shut down the computer, restart the computer
ExitWindowsEx function can be achieved by these three functions, first make the following statement:
Parameter 2 remains unused, it is advisable 0; take 0 parameters one can log off the current user, you
can take a turn off the computer, take the two can restart the computer, and its value
In the PB programming, some programs can be run using Run (). For example, the user presses the F1,
you run a chm file. Run the program but can not
PB coordination with the main program, if the user presses a number of F1, will launch multiple
instances Run the program, the main program exits, Run the program remains
Operation. You can use the following functions to enable them to coordinate work:
// Look for Run program is already running, wtitle title Run program
To program the remote host's resources mapped to a local drive, you can use the following function:
Function long WNetAddConnectionA (String path, string pwd, String drv) Library "mpr.dll"
The following code can share files on a remote host Alexander My Documents folder is mapped to the
local J disk:
It acts to perform at the DOS prompt: Net Use J: file: // alexandermy / Documents
To show or hide the taskbar, it must first get the window handle. Taskbar is a special window, its window
class as follows:
Shell-TrayWnd, no title, it can only be used FindWindowEx function to get its handle:
Function long FindWindowEx (long ph, long ch, ref String cn, ref String wn) Library 'user32'
Use ShowWindow to show or hide the window, its second parameter is 0 to hide for five, said display:
GetShortPathName function through long file names can be converted to 8.3 format, which is declared
as:
Function Long GetShortPathNameA (String lf, ref String sf, Long buflen) Library 'kernel32'
Parameter 1 for long file names, parameter 2 to save short file name buffer, the buffer length parameter
3. For example:
GetShortPathNameA ("C: \ My Documents \ PowerBuilder programming practices .Doc", sf, 256) // sf =
Space (256)
Delay function is useful, although PB is not provided, but can be extended by the Win32 Sleep function:
PB did not provide any multimedia function, to play music only through the Win32 API PlaySound to
achieve:
Function Long PlaySound (String Filename, Int Mod, Int Flags) Library "winmm.dll"
Wav file name parameter 1, parameter 2 must be 0, parameter 3 to take a background player said, taking
eight said loop, so take 9 (= 1 + 8) in the background loop.
Function uint GetWindowsDirectoryA (ref string dirtext, uint textlen) library "KERNEL32.DLL"
Script follows:
String ls_WinPath
Function uLong SendMessageA (ulong hWnd, ulong wMsg, ulong wParam, string lParam) library
"user32.dll"
External user-defined object uo_comctl_animate, DLL name filled comctl32.dll, class names fill
sysanimate32.
Next, create the user object uo_test in the window, calling uo_test.of_playavi ("xxx.avi")
FUNCTION boolean ShowWindow (ulong winhandle, & int wincommand) Library "user32"
FUNCTION long FindWindowA (ulong Winhandle, & string wintitle) Library "user32"
long ll_winhandle
If ll_winhandle> 0 Then
BringWindowToTop (ll_winhandle)
ShowWindow (ll_winhandle, 5)
Return
End If
Open (w_test)
function long GetShortPathNameA (string lpLong, ref string lpShort, long lBuff) library 'kernel32'
String ls_Buffer
Long ll_RC
RETURN ls_Buffer
other event occurs when a Windows message and when the message is do not correspond to the control
of a powerBuilder event trigger;
The numerical number message.number representative events, this number is provided by Windows
// PB of SHELL command
Function: Display "Control Panel -> Accessibility Options -> Keyboard" option Windows
Function: Display "Control Panel -> Accessibility Options -> Display" option Windows
Function: Display "Control Panel -> Accessibility Options -> Mouse" option Windows
Function: Display "Control Panel -> Accessibility Options -> General" option Windows
Function: Display "Control Panel -> Add / Remove Programs -> Install / Uninstall" panel.
Function: Display "Control Panel -> Add / Remove Programs -> Install Windows" panel.
Function: Display "Control Panel -> Add / Remove Programs -> Startup Disk" panel.
Function: Display "Create Shortcut" dialog box, created a shortcut to the location determined by the% 1
parameter.
Function: Display the "Display Properties -> Screen Saver" option window.
Function: Display "Control Panel -> Game Controllers -> General" option window.
Function: Display "Control Panel -> Game Controllers -> Advanced" options window.
Function: Display "Control Panel -> Keyboard Properties -> Language" option window.
Function: Display "Control Panel -> Input Method Properties -> Input Method" option window.
Function: Display "Control Panel -> Multimedia Properties -> Audio" property page.
Function: Display "Control Panel -> Multimedia Properties -> Video" property page.
Function: Display "Control Panel -> Multimedia Properties -> MIDI" property page.
Function: Display "Control Panel -> Multimedia Properties -> CD Music" property page.
Function: Display "Control Panel -> Multimedia Properties -> Device" property page.
Function: Display the specified file (drive: \ path \ filename) of the "Open" dialog box.
46. command: rundll32.exe shell32.dll, Control_RunDLL password.cpl
Function: Display "Control Panel -> Power Management Properties" option window.
Function: Display Windows "Printers" folder. (With rundll32.exe shell32.dll, Control_RunDLL main.cpl //
2)
Function: Display "Control Panel -> Regional Settings Properties -> Regional Settings" option window.
Function: Display "Control Panel -> Regional Settings Properties -> Digital" option window.
Function: Display "Control Panel -> Regional Settings Properties -> Currency" option window.
Function: Display "Control Panel -> Regional Settings Properties -> Time" option window.
Function: Display "Control Panel -> Regional Settings Properties -> Date" option window.
Function: The screen saver file specified settings for Windows screensavers, screen saver and display
properties window.
Function: Display "Control Panel -> System Properties -> Traditional" Properties window.
Function: Display "Control Panel -> System Properties -> Device Manager" Properties window.
Function: Display "Control Panel -> System Properties -> Hardware Profiles" Properties window.
Function: Display "Control Panel -> System Properties -> Performance" Properties window.
vbKeyRButton 2 Right
vbKeyA 65 A key
vbKeyB 66 B key
vbKeyC 67 C bond
vbKeyD 68 D key
vbKeyE 69 E key
vbKeyF 70 F key
vbKeyG 71 G keys
vbKeyH 72 H bond
vbKeyI 73 I bond
vbKeyJ 74 J key
vbKeyK 75 K keys
vbKeyL 76 L key
vbKeyM 77 M bond
vbKeyN 78 N bond
vbKeyO 79 O bond
vbKeyP 80 P key
vbKeyQ 81 Q key
vbKeyR 82 R key
vbKeyS 83 S bond
vbKeyT 84 T key
vbKeyU 85 U key
vbKeyV 86 V key
vbKeyW 87 W key
vbKeyX 88 X key
vbKeyY 89 Y bond
vbKeyZ 90 Z key
vbKey0 48 0 key
vbKey1 49 1 key
vbKey2 50 2 keys
vbKey3 51 3 keys
vbKey4 52 4 key
vbKey5 53 5 keys
vbKey6 54 6 key
vbKey7 55 7 key
vbKey8 56 8 key
vbKey9 57 9 key
vbKeyNumpad0 96 0 key
vbKeyNumpad1 97 1 key
vbKeyNumpad2 98 2 keys
vbKeyNumpad3 99 3 keys
// Function keys
// PBCatTbl
pbd_fptc character spacing and font data series, obtained by adding the two constants
pbh_ fwgt title font stroke thickness (400 = Normal, 700 = Bold)
pbh_fptc title character spacing and font family, by two constants obtained by adding
pbl_ fwgt label font stroke thickness (400 = Normal, 700 = Bold)
pbl_fptc label font character spacing and series, the number obtained by adding the two
// PBCatCol
pbc_labl label
pbc_hdr title
pbc_tag (reserved)
// PBCatFmt
// PBCatVld
// PBCatEdt
pbe_seqn type PNCatEdt standard for editing multiple lines need to specify the line sequential
// Window among the enter event! In datawindow events which create a custom event ue_enter, in
even_id among paste "pbm_dwnprocessenter"
li_col = dw_1.GetColumn ()
ll_row = dw_1.GetRow ()
ll_RowCount = dw_1.RowCount ()
dw_1.setredraw (false)
setcolumn (dw_1,1)
dw_1.setredraw (true)
dw_1.SetFocus ()
return 1
end if
end if
return 1
// How in the program for datawindow plus computational domain or line
// The following procedure plus a computational domain sum (dept_id for all)
string ls_modrow
ls_modrow = 'Create compute (band = summary font.charset = "0" font.face = "MS Sans Serif" font.family
= "2" font.height = "- 8" font.pitch = "2" font.weight = "400" background.mode = "1" background.color =
"536870912" color = "0" x = "9" y = "4" height = "52" width = "297" format = "[general]" expression =
"sum (dept_id for all)" alignment = "1" border = "0" crosstab.repeat = no) ~ r ~ n '
dw_1.modify (ls_modrow)
string ls_line
ls_line = 'Create line (band = detail background.mode = "2" background.color = "16777215" pen.style =
"0" pen.width = "5" pen.color = "0" x1 = "37" y1 = "320" x2 = "1458" y2 = "316") ~ r ~ n '
dw_1.modify (ls_line)
dw_1.settransobject (sqlca)
dw_1.retrieve ()
For example, I want to control the operating authority of a button in a window which
In datawindow, the operation of a field can be operated property, is to separate the coding of these it
Windows were placed in authority among variables, and then cancel the permission of the window on it!
f_wincenter (windowname)
environment lenv
long ll_height, ll_width
else
end if
return 1
FUNCTION unit getmodulefilenamea (ulong hmodule, ref string lpfilename, ulong nsize) library
"kernel32.dll"
int i
setnull (ls_buffer)
else
loop
end if
return ls_buffer
// Get the current name of the computer
FUNCTION boolean GetComputerNameA (ref string cname, ref long nbuf) LIBRARY "kernel32.dll"
Return ls_computername
FUNCTION ulong GetCurrentDirectoryA (ulong nBufferLength, ref string lpBuffer) Library kernel32.dll "
String ls_buffer
Setnull (ls_buffer)
Else
End if
Return ls_buffer
ODBC is automatically created based on the Windows registry direct writes to achieve
Steps:
Registryset (ls_key1, as_odbc_name, "PB INTERSOLV OEM 3.01 32-BIT dBASEFile (* .dbf)")
end if
end if
...
Second, before the establishment of the first to create the ODBC connection information, such as
...
SQLCA.DBMS = "ODBC"
SQLCA.AutoCommit = False
SQLCA.Database = 'TestDBF'
halt close;
end if
...
...
Through the above steps, you do not through ODBC tool in Control Panel to set up.
2, an ODBC own set of tools that can operate within the system;
First two excellent dropdownlistbox, when select one of the item, and another dropdownlistbox display
the corresponding first
Select the content item. For example, a display name of each center, when you select the name of one of
the center, and the other displays the corresponding center
Long ll_model
datawindowchild idwc_model
idwc_model.Retrieve ()
idwc_model.filter ()
end if
// Grid window in which, in a column does not allow editing a column allows editing
With the following method, you can not very convenient, what they want it
// Method one:
In the DataWindow, between the column and the column when using the Tab key to move, is based on
the DataWindow Tb values for each column is set to be moved.
When a column of Tab is 0, this column can not be edited, so that users can not add, delete, change and
other operations. It can be a column of values Tab is set to 0,
Follows (set columnname for the DataWindow column name to be set to non-editable):
dw_1.setorder ("columnname", 0)
The advantage of this method is easy to realize, the drawback is not allowed to move the column. Grid-
style DataWindow that must not checked
column moving, otherwise it will cause confusion when you press the tab key sequence.
// Method two:
You can view the edit column properties in the properties view style style. To set a column can not be
edited in the column edi style = "edit" in
Select the display only; or script window with the following statement be modified:
This method is very simple, but also does not allow the column to move.
// Method three:
DataWindow with the clicked event of the method can be implemented to protect the column. If a
column can not be changed, you can set r otect = 0. Namely:
This method does not affect the Tab key to move, users can pull the column, but also in the application
process to decide which column can be edited, which column is not
Edited.
// Data Sheet d_query have a data column id, set to DropDownDW format and linked to another data
table d_info (id, name).
Data is displayed when the program is running so the value name, and dw_1.getitemstring (1, 'id') /
dw_1.object.date (1,1)
The resulting data is id value. But now I want the name of values , there is no simple way
dw_object.Describe ("evaluate ('LookUpDisplay (" Column Name ")'," + String (line number) + ")")
You is:
// Window within w_gcde, into a DW_1, how to get the contents inside yuonghu_id column dw_1
long lng_column_count
integer i
for i = 1 to lng_column_count
next
int f_s
boolean lb_exist
f_s = GetFileSaveName ("Please select the file name to be saved", fpath, fname, "txt", "Text File (* .txt),
*. txt, Excel (*. xls), *. xls")
return
choose case MessageBox ("Save", "OK to over write file:" + fname, Question !, OKCancel!)
case 1
case else
return
end choose
else
end if
int i, handle, n
messagebox ('prompt', 'Please open EXCLE program! and open BOOK1.XLS, and empty the table!')
return
end if
for i = 1 to tab_1.tabpage_1.dw_1.rowcount ()
next
closechannel (handle)
// Save the data window for generic functions excel (decision wonderful)
// Scope: public
// Description: The window to pass the data to EXCEL table, there are 26 columns limit (generally been
good enough)
// Parameters:
Pointer oldpointer
OLEObject ole_object
Integer li_ret
////////////////////////////////////////////////// ////////////////////
// ================================================ ====================
// [Reason]: Since then the case has been opened EXCEL, and sometimes when using the OLE connection
error, so instead
// ------------------------------------------------ --------------------
// ================================================ ====================
MessageBox ('open error', '! Unable to connect EXCEL EXCEL has been installed the wrong number: ' +
String (li_ret))
RETURN 0
END IF
// END IF
ole_object.Workbooks.Add
String ls_value
The number of rows // Excel table for the number of rows of data window +2
ll_rownum = adw_data.RowCount () + 2
String ls_colname
Integer i, j
Dec ld_width
i=1
IF adw_data.DESCRIBE ("#" + String (ll_num) + ". Visible") = "1" THEN // column does not show signs of
nun_Visible
i=i+1
ls_obj = adw_data.DESCRIBE ("#" + String (ll_num) + ". name") // actually stored value field name
ls_objtag [i] = adw_data.DESCRIBE (ls_obj + "_t.text") // display the value of the field name
END IF
NEXT
ole_object.Selection.Font.Size = 24
ole_object.Selection.HorizontalAlignment = 3
FOR i = 1 TO ll_colnum
ld_width = 12
ELSE
END IF
NEXT
FOR i = 3 TO ll_rownum
FOR j = 2 TO ll_colnum
END IF
IF adw_data.DESCRIBE (column_name + '.type') = 'compute' THEN
ls_value = adw_data.DESCRIBE ("Evaluate ('" + adw_data.DESCRIBE (column_name +' .expression ') + "',"
+ String (i - 2) + ")")
END IF
END IF
NEXT
NEXT
////////////////////////////////////////////////// ////////////////////
// ================================================ ====================
// ------------------------------------------------ --------------------
// ================================================ ====================
integer value
value = GetFileSaveName ("Save As", sFileName, sFile, "xls", "Excel Files (* .xls), *. xls")
IF value = 1 THEN
ole_object.ActiveWorkbook.saveas (sFileName)
ELSE
END IF
////////////////////////////////////////////////// ////////////////////
SetPointer (oldpointer)
ole_object.DisconnectObject ()
DESTROY ole_object
RETURN 1
// ================================================ ===========================
// Return value: string retVal calculated value of the expression, such as 2 * (3 + 5) result is 16
// ================================================ ===========================
// ================================================ ===========================
string retVal
datastore lds_evaluate
destroy lds_evaluate
return retVal
// String into an array
DO WHILE lPosEnd> 0
lCounter ++
LOOP
RETURN lCounter
PowerBuilder TreeView control in a tree tour, similar to the WINDOWS Explorer, which is characterized
by tree-level information items were
Structure, can show more clearly the main, a breakdown of the relationship, the operation is very
convenient. It can be used in conjunction with the DataWindow application, a
Provide information classification system, one to provide specific information to achieve even beads Pitt
together wonderful effect. It is especially suitable for multi-level classification of information seized
Faso, is a multi-level menu can not be more than like, its manifestations by the program designers and
the majority of users in many application software
In PowerBuilder, application TreeView control is much more complex than the other controls, somewhat
at a loss when you are new to it often. However, if
The mechanism to figure out if it, it is not hard to grasp things. Here I combine Changbai company books
classification and retrieval instance, the TreeView
2, built an application window W_1 in the application, adding datawindow control object named dw_3
and dw_4 two on and one in the name
General: The Datawindow object datawindow called DW_date fill in the name of an existing (Note: it
datawindow control object is different), for spanning tree view item, set its Visible items are not visible.
General: The Datawindow object datawindow object name to fill an existing named DW_TS for display
check out
TreeView tree view item can not be directly edited, the program must be written in the Script.
Picture: Picture Name added in four different icons to represent the tree view of two levels (one, two),
two kinds of
Edit Labels: whether to allow the operation to change entries, click the title entries. Show Buttons:
whether to display the entries put
Hide Selection: when the control loses focus, the selected item is displayed with high brightness.
Lines At Root: All entries in the root zone is connected by a vertical bar.
Indentation: the child entries shrink relative to the right schedule parent entries.
Mr. Cheng root layer view item, and then dynamically generate lower view items in the application, the
other is the tree view of all time and a. Each of the two methods
There are advantages, chosen according to the specific circumstances, the latter method is used in this
example.
Level: Integer type, tree view item level in the tree view.
Children: Boolean type, which determines whether the next level (as shown in the title).
PictureIndex: Integer type, when used in the non-selected icons in the icon queue number.
SelectedPictureIndex: Integer type, when used by the selected number of icons in the icon queue.
InsertItem (): will join the item into the back of the specified items
Constructor: This event is triggered when the control is created, can be constructed here TreeViewItem.
Double Click: Double-click the TreeViewItem item, execute the query process.
ItemPopulate event: This event when entries for the first time launched a TreeViewItem trigger, while
the system will trigger the
TreeViewItem item handle handle passed over by the arguments. It is mainly used to generate the
underlying information item corresponding item. Mainly used for the first
Ways.
A tree view control TV_1 the constructor event code wanqi 1999.6.28
// long ii_h_l_one
// long ii_h_l_two
dw_3.sort ()
li_current_ei = ""
end if
itvi_level_one.level = 1 // level
itvi_level_one.data = li_current_dn
itvi_level_one.pictureindex = 1
end if
itvi_level_two.level = 2
itvi_level_two.data = li_current_dn
itvi_level_two.pictureindex = 2
itvi_level_two.selectedpictureindex = 4
itvi_level_two.data = li_current_ei
itvi_level_two.children = false
ii_h_l_two = this.insertitemlast
(ii_h_l_one, itvi_level_two)
// The item was added to the two trees in the last one
end if
end if
li_last_ei = li_current_ei
next
string s1
treeviewitem ii
case 1
// Filter category
dw_4.filter ()
case 2
dw_4.filter ()
// Filtering title
end choose
string CN_NUM [10] = {"zero", "one", "two", "three", "market", "Mrs.", "Miss", "seven", "eight",
"Nine"} // capital 0-9
string CN_CARRY [19] = {"minute", "corner", "", "dollars", "pick up", "Bai", "1,000", "000", "pick up",
"Bai", "1,000" "100 million", "pick up", "Bai", "1,000", "000", "pick up", "Bai", "1,000"}
Boolean lb_zero = FALSE // whether to allow the next one appears zero
ls_rc + = "negative"
continue
END IF
IF Right (ls_rc, 2) = CN_NUM [1] THEN ls_rc = Left (ls_rc, Len (ls_rc) - 2)
END IF
NEXT
IF Right (ls_rc, 2) = CN_NUM [1] THEN ls_rc = Left (ls_rc, Len (ls_rc) - 2)
RETURN ls_rc
In the case of continuous paper to print the data window, you need to customize the printed pages long,
in order to ensure the correct printer paper feed without human intervention,
Continuous printing. In PB shall call external functions to customize the length of the paper, more
cumbersome. This paper presents a direct printer
Communication Computer and printer using the ASCII code, which includes the standard ASCII code
printable characters and non-printing characters (control codes),
The printer uses control code to customize the printer. Most printer instructions use control codes
escape sequence code as the first of its instruction sequence.
Decimal 2748
Decimal 27 67 n
In PB to achieve by sending control codes to the printer function Printsend (printjobnumber, string,
{zerochar}).
Because of the string, 0-terminated string, if string contains 0, you need to use other characters to
represent 0, parameters that do this zerochar
Purposes set, when the PB to the printer transmits a control string to replace the character zerochar
converted to 0.
Here is the complete program specific custom pages long print data window (length of 2.75 inches
custom page):
long ll_job
dw_print.reset ()
ll_job = printopen ()
if ll_job = -1 then
return
end if
// 8-inch custom spacing
printclose (ll_job)
Line 22 is a narrow line just one-third of a page long continuous paper, many bills are not the problem in
this paper .win2000, my program run well.
1.RGB function formula: color values = (65536 * Blue) + (256 * Green) + (Red)
3 How to use the drop-down drop down sub-program control data window and away
5 how to shield the mouse wheel to trigger events in the control of other write
string ls_dwsyntax
long ll_count, i
for i = 1 to ll_colnum
9 How to achieve without using SELECT DISTINCT delete duplicate rows in the DataWindow SQL syntax:
At first you want to display a column to sort of unique values : "city A", and then add the following filter
string:
10. how to change the font color column, this column is to remind the user to make changes:
In this condition, if this column has changed, is displayed in red font, otherwise display black font. This
expression is mainly used
column_name <> column_name.Original compare the current value of the column and the original
columns are the same to achieve the purpose of judgment.
11 written clicked or doubleclicked event data window on annotations // solve some unexpected bug!
Now assume that the customer's province, city, address, zip code were stored in a different field, they
are Province, City, Address,
PC. We want to get "Zip + State + City + address" format, such as: "(214001) Renmin Road, Wuxi City,
Jiangsu Province 1." Specific implementation
As follows:
1, in the position you want to display to add a calculated field (Compute Field)
2, in which the expression column write "'(' + PC + ')' + Province + City + Address"
3 Click OK to finish.
It is not easy. Need to remind everyone that the computational domain can only be used to display, you
can not modify it, because it does not TAB property,
When we write, such as inventory, sales and other applications, always want the program to be able to
dynamically auto-refresh inventory or sales, for example,
Every 1 second refresh. To achieve this function as long as we use the time interval of the data window
properties (Timer Interval),
When the value is 0 data window is not refreshed, if you want the data window to refresh frequency
every second, so long as the value is set
We can also add functionality to the application flashing alarms. Take inventory for instance, the most
common is when the stock reaches certain goods
When a minimum inventory program should be able to automatically determine and display a warning
color, usually red. At this point, we simply use the above
The method then requires the flashing on the field, such as stocks, in which the color properties of the
corresponding write statement. The following code to achieve
"When an item of inventory is less than 20, the program displays a warning in red blinking"
if mod (Second (Now ()), 2) <> 0, & // once per second, even red, odd-numbered display white, i.e.
background
// How to find the listed conditions for Datetime data types used in the DataWindow
1. Use when you want to find a date condition is a constant expression as follows:
2. The following expression uses the date the conditions when you are looking for is a variable:
3. Use when you want to find the date of the conditions is a DateTime data type the following
expression:
// Realize how not to use SELECT DISTINCT delete duplicate rows in the DataWindow SQL syntax
At first you want to display a column to sort of unique values : "city A", and then add the following filter
string:
// How to display line numbers in each group, respectively, in the form of packets of the DataWindow
When we Datawindow display line numbers for each line, you can simply put an expression of GetRow ()
computed column.
But for grouping Datawindow, to show the line number in each group, you should use the expression for
// How to change the font color column, this column is to remind the user to make changes
In this condition, if this column has changed, is displayed in red font, otherwise display black font. This
expression is mainly used
column_name <> column_name.Original compare the current value of the column and the original
columns are the same to achieve the purpose of judgment.
// In the data window, remove the line, but do not filter or delete operation
RowsDiscard () function to do this, it is removed to perform work in the data window, but it can not be
removed in the row is deleted or any
// How DataWindow display multiple lines in the Footer Band data is displayed in the first line of the
current and the last line number
IF (GetRow () = First (GetRow () FOR Page), 1, 0) // 1 for the first row of the current page
IF (GetRow () <> 1 AND GetRow () = Last (GetRow () FOR Page), 1, 0) // 1 as the last line of the current
page
By seen above, set the following computed column expression in the Footer Band:
'Rows' + String (First (GetRow () FOR Page)) + 'to' + String (Last (GetRow () FOR Page)) + 'are displayed'.
// Window Center:
Answer: a name, then the same value as the field! Named in the name attribute in compute_1
2, in the column to be set to automatically wrap, double-click the mouse properties window bounce this
column;
4, select the Edit tab, and uncheck Auto Horz Scroll checkbox;
6, points Detail Band (ie written Detail gray long belt), click the right mouse button and select
Properties ... menu item;
7, select Autosize Height checkbox;
9, save DataWindow.
if (len (trim (file_name)) / 18> 1, ceiling (len (trim (file_name)) / 18) * 24,18) how many characters on the
fold line
Can be directly assigned to a variable, not written in functional form. Another function is suitable for
pb6.5, a character occupies two bytes, if used
mid (fill ('Rat Ox Tiger Rabbit snakes Horse Sheep Monkey Jigou pig', 48), (mod (ls_year -1900,12) +13) *
2 -1,2)
mid (fill ('B, CD Wuji Gengxin Jen-kuei', 40), (mod (ls_year -1924,10) +11) * 2 -1,2) + mid (fill ('Zichou Mao
Yin Chen Si Wu did not Shenyou Xu Hai' , 48), (mod (ls_year -1924,12) +13) * 2 -1,2)
mid ("Capricorn Aquarius Pisces Aries Taurus Gemini Cancer Leo Virgo Libra Scorpio Sagittarius
Capricorn", (month (ls_date) + sign (sign (day (ls_date) - (19 + integer (mid ('102123444423', month
(ls_date), 1)))) + 1)) * 4 3,4) + 'seat'
// 4 judgment leap year. (Year parameters: int ls_year return parameters: int 0 = average year, 1 = leap
year):
abs (sign (mod (sign (mod (abs (ls_year), 4)) + sign (mod (abs (ls_year), 100)) + sign (mod (abs (ls_year),
400)), 2)) -1 )
integer (28 + integer (mid ('3' + string (abs (sign (mod (sign (mod (abs (year (ls_date)), 4)) + sign (mod
(abs (year (ls_date)), 100) ) + sign (mod (abs (year (ls_date)), 400)), 2)) -1)) + '3232332323', month
(ls_date), 1)))
// 6 date of the last day of a month. (Date parameters: date ls_date return parameters: date):
date (year (ls_date), month (ls_date), integer (28 + integer (mid ('3' + string (abs (sign (mod (sign (mod
(abs (year (ls_date)), 4)) + sign (mod (abs (year (ls_date)), 100)) + sign (mod (abs (year (ls_date)), 400)),
2)) -1)) + '3232332323', month (ls_date), 1)) ))
// 7 the last day of a month seeking another date (date parameters: date ls_date return parameters:
date):
a.RelativeDate (date (year (ls_date) + sign (month (ls_date) -12) + 1, mod (month (ls_date) +1,13) + abs
(sign (mod (month (ls_date) +1,13) ) -1), 1) - 1)
b.RelativeDate (date (year (ls_date) + integer (month (ls_date) / 12), mod (month (ls_date), 12) +1,1), - 1)
// 8 seeking another few days a month. (Date parameters: date ls_date return parameters: int):
a.day (RelativeDate (date (year (ls_date) + sign (month (ls_date) -12) + 1, mod (month (ls_date) +1,13) +
abs (sign (mod (month (ls_date) +1, 13)) -1), 1) - 1)),
b.day (RelativeDate (date (year (ls_date) + integer (month (ls_date) / 12), mod (month (ls_date), 12)
+1,1), - 1))
// 9 a certain day of the week - with the PB system function DayName. (Date parameters: date ls_date
return parameters: string):
'Week' + mid ('day one hundred twenty-three thousand four hundred fifty-six', (mod (year (ls_date) -1 +
int ((year (ls_date) -1) / 4) - int ((year (ls_date) -1) / 100) + int ((year (ls_date) -1) / 400) + daysafter (date
(year (ls_date), 1,1), ls_date) +1,7) +1) * 2 -1,2)
// 10 seeking several months apart after a relative date (the date parameters: date ls_date apart month
(desirable negative): int ls_add_month return parameters: date):
date (year (ls_date) + int ((month (ls_date) + ls_add_month) / 13), long (mid (fill
('010203040506070809101112', 48), (mod (month (ls_date) + ls_add_month -1,12) +13 ) * 2 -1,2)), day
(ls_date) -integer (right (left (string (day (RelativeDate (date (year (ls_date) + int ((month (ls_date) +
ls_add_month) / 13) + sign (long (mid (fill ('010203040506070809101112', 48), (mod (month (ls_date) +
ls_add_month -1,12) +13) * 2 -1,2)) -12) + 1, mod (long (mid (fill ('010203040506070809101112', 48),
(mod (month (ls_date) + ls_add_month -1,12) +13) * 2 -1,2)) + 1,13) + abs (sign (mod (long (mid (fill
('010203040506070809101112', 48), (mod (month (ls_date) + ls_add_month -1,12) +13) * 2 -1,2)) +
1,13)) -1), 1), - 1) ) -day (ls_date), '00') + '00000', 5), 3)) / 100)
// 11 weeks of the year in which demand a certain date. (Date parameters: date ls_date return
parameters: int):
// a1
abs (int (- ((daysafter (RelativeDate (date (year (ls_date), 1,1), -mod (year (ls_date) -1 + int ((year
(ls_date) -1) / 4) - int ((year (ls_date) -1) / 100) + int ((year (ls_date) -1) / 400) + 1,7) +1), ls_date) +1) /
7)))
// b1
abs (int (- ((daysafter (RelativeDate (date (year (ls_date), 1,1), -integer (mid ('6012345', mod (year
(ls_date) -1 + int ((year (ls_date) -1 ) / 4) - int ((year (ls_date) -1) / 100) + int ((year (ls_date) -1) / 400) +
1,7), 1))), ls_date) +1) / 7 )))
abs (int (- ((daysafter (RelativeDate (date (year (ls_date), 1,1), -integer (mid ('6012345', DayNumber (date
(year (ls_date), 1,1)), 1)) ), ls_date) +1) / 7)))
// 12 seeking a date relative to the past few weeks in which a certain date. (Date parameters: date
ls_date_1 (requires a certain date), ls_date_2 (past a certain date) return parameters: int):
// a1
abs (int (- ((daysafter (RelativeDate (ls_date_2, -mod (year (ls_date_2) -1 + int ((year (ls_date_2) -1) / 4) -
int ((year (ls_date_2) -1) / 100) + int ((year (ls_date_2) -1) / 400) + daysafter (date (year (ls_date_2), 1,1),
ls_date_2) + 1,7) +1), ls_date_1) +1) / 7)))
abs (int (- ((daysafter (RelativeDate (ls_date_2, -DayNumber (ls_date_2) +1), ls_date_1) +1) / 7)))
// b1
abs (int (- ((daysafter (RelativeDate (ls_date_2, -integer (mid ('6012345', mod (year (ls_date_2) -1 + int
((year (ls_date_2) -1) / 4) - int ((year (ls_date_2) -1) / 100) + int ((year (ls_date_2) -1) / 400) + daysafter
(date (year (ls_date_2), 1,1), ls_date_2) + 1,7), 1))), ls_date_1) +1) / 7)))
abs (int (- ((daysafter (RelativeDate (ls_date_2, -integer (mid ('6012345', DayNumber (ls_date_2), 1))),
ls_date_1) +1) / 7)))
// pb pure function analog Explorer window, click the mouse in action dynamic data sorting and display
the sort arrow
// Invoke rules: In the data window controls clicked written f_dwsort (this, dwo)!
// Fdwo_dwo dwobject
Long ll_pos
int li_i
ls_clicked_pos = fdwo_dwo.Name
If ll_pos> 0 Then
ls_tag = fdwo_dwo.tag
Else
End If
ls_column [li_i] = fdw_dw.describe ("#" + string (li_i) + ".Name") // get column names
ls_text = fdw_dw.Describe (ls_column [li_i] + "_t.text")
end if
next
end if
end if
fdw_dw.SetSort (ls_format)
fdw_dw.Sort ()
End If
Today saw the first character of a fetch function xuejun characters, and try a little, feeling very good, not
exclusive, come to share with you:
$ PBExportHeader $ uf_getfirstletter.srf
$ PBExportComments $ return for a given string of characters string initials, xuejun, 19990821
end type
forward prototypes
global function string uf_getfirstletter (string as_inputstring)
end prototypes
// Used to: Returns the given string of characters string initials, that consonant strings
// Return Value: ls_ReturnString - String, given the string of consonants string characters, all lowercase
// Notice: 1. the validity of this method is based on the national standard kanji characters Reservoir bit
encoding, this encoding systems do not meet this function is invalid!
// 2 If the Chinese character string containing non-Kanji characters, such as graphic symbols or ASCII
code, then these non-kanji characters will remain unchanged.
// Scripts:
start area code char lc_FirstLetter [23] // store GB a different pronunciation of the corresponding
Chinese character pronunciation
start area code integer li_SecPosValue [23] // store GB a different pronunciation of Chinese characters
integer i, j
li_SecPosValue [] =
{1601,1637,1833,2078,2274,2302,2433,2594,2787,3106,3212,3472,3635,3722,3730,3858,4027,4086,43
90,4558,4684,4925,5249 }
lc_FirstLetter [] = {"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M "," N "," O "," P "," Q "," R "," S ","
T "," W "," X "," Y "," Z "}
ls_SecondSecTable = "CJWGNSPGCGNE [Y [BTYYZDXYKYGT [JNNJQMBSGZSCYJSYY [PGKBZGY
[YWJKGKLJYWKPJQHY [W
[DZLSGMRYPYWWCCKZNKYYGTTNJJNYKKZYTCJNMCYLQLYPYQFQRPZSLWBTGKJFYXJWZLTBNCXJJJJTXDTTS
QZYCDXXHGCK [PHFFSS [YBGXLPPBYLL [HLXS [ZM
[JHSOJNGHDZQYKLGJHSGQZHXQGKEZZWYSCSCJXYEYXADZPMDSSMZJZQJYZC [J
[WQJBYZPXGZNZCPWHKXHQKMWFBPBYDTJZZKQHYLYGXFPTYJYYZPSZLFCHMQSHGMXXSXJ
[[DCSBBQBEFSJYHXWGZKPYLQBGLDLCCTNMAYDDKSSNGYCSGXLYZAYBNPTSDKDYLHGYMYLCXPY
[JNDQJWXQXFYYFJLEJPZRXCCQWQQSBNKYMGPLBMJRQCFLNYMYQMSQYRBCJTHZTQFRXQHXMJJCJLXQG
JMSHZKBSWYEMYLTXFSYDSWLYCJQXSJNQBSCTYHBFTDCYZDJWYGHQFRXWCKQKXEBPTLPXJZSRMEBWHJL
BJSLYYSMDXLCLQKXLHXJRZJMFQHXHWYWSBHTRXXGLHQHFNM [YKLDYXZPYLGG
[MTCFPAJJZYLJTYANJGBJPLQGDZYQYAXBKYSECJSZNSLYZHSXLZCGHPXZHZNYTDSBCJKDLZAYFMYDLEBBGQ
YZKXGLDNDNYSKJSHDLYXBCGHXYPKDJMMZNGMMCLGWZSZXZJFZNMLZZTHCSYDBDLLSCDDNLKJYKJSYCJ
LKWHQASDKNHCSGANHDAASHTCPLCPQYBSDMPJLPZJOQLCDHJJYSPRCHN
[NNLHLYYQYHWZPTCZGWWMZFFJQQQQYXACLBHKDJXDGMMYDJXZLLSYGXGKJRYWZWYCLZMSSJZLDBYD
[FCXYHLXCHYZJQ [[QAGMNYXPFRKSSBJLYXYSYGLNSCMHZWWMNZJJLXXHCHSY
[[TTXRYCYXBYHCSMXJSZNPWGPXXTAYBGAJCXLY
[DCCWZOCWKCCSBNHCPDYZNFCYYTYCKXKYBSQKKYTQQXFCWCHCYKELZQBSQYJQCCLMTHSYWHMKTLKJL
YCXWHEQQHTQH [PQ
[QSCFYMNDMGBWHWLGSLLYSDLMLXPTHMJHWLJZYHZJXHTXJLHXRSWLWZJCBXMHZQXSDZPMGFCSGLSX
YMJSHXPJXWMYQKSMYPLRTHBXFTPMHYXLCHLHLZYLXGSSSSTCLSLDCLRPBHZHXYYFHB
[GDMYCNQQWLQHJJ [YWJZYEJJDHPBLQXTQKWHLCHQXAGTLXLJXMSL [HTZKZJECXJCJNMFBY
[SFYWYBJZGNYSDZSQYRSLJPCLPWXSDWEJBJCBCNAYTWGMPAPCLYQPCLZXSBNMSGGFNZJJBZSFZYNDXHP
LQKZCZWALSBCCJX
[YZGWKYPSGXFZFCDKHJGXDLQFSGDSLQWZKXTMHSBGZMJZRGLYJBPMLMSXLZJQQHZYJCZYDJWBMYKLD
DPMJEGXYHYLXHLQYQHKYCWCJMYYXNATJHYCCXZPCQLBZWWYTWBQCMLPMYRJCCCXFPZNZZLJPLXXYZT
ZLGDLDCKLYRZZGQTGJHHGJLJAXFGFJZSLCFDQZLCLGJDJCSNZLLJPJQDCCLCJXMYZFTSXGCGSBRZXJQQCTZH
GYQTJQQLZXJYLYLBCYAMCSTYLPDJBYREGKLZYZHLYSZQLZNWCZCLLWJQJJJKDGJZOLBBZPPGLGHTGZXYGHZ
MYCNQSYCYHBHGXKAMTXYXNBSKYZZGJZLQJDFCJXDYGJQJJPMGWGJJJPKQSBGBMMCJSSCLPQPDXCDYYK
Y
[CJDDYYGYWRHJRTGZNYQLDKLJSZZGZQZJGDYKSHPZMTLCPWNJAFYZDJCNMWESCYGLBTZCGMSSLLYXQSX
SBSJSBBSGGHFJLYPMZJNLYYWDQSHZXTYYWHMZYHYWDBXBTLMSYYYFSXJC [DXXLHJHF
[SXZQHFZMZCZTQCXZXRTTDJHNNYZQQMNQDMMG
[YDXMJGDHCDYZBFFALLZTDLTFXMXQZDNGWQDBDCZJDXBZGSQQDDJCMBKZFFXMKDMDSYYSZCMLJDSY
NSBRSKMKMPCKLGDBQTFZSWTFGGLYPLLJZHGJ
[GYPZLTCSMCNBTJBQFKTHBYZGKPBBYMTDSSXTBNPDKLEYCJNYDDYKZDDHQHSDZSCTARLLTKZLGECLLKJLQ
JAQNBDKKGHPJTZQKSECSHALQFMMGJNLYJBBTMLYZXDCJPLDLPCQDHZYCBZSCZBZMSLJFLKRZJSNFRGJHX
PDHYJYBZGDLQCSEZGXLBLGYXTWMABCHECMWYJYZLLJJYHLG
[DJLSLYGKDZPZXJYYZLWCXSZFGWYYDLYHCLJSCMBJHBLYZLYCBLYDPDQYSXQZBYTDKYXJY
[CNRJMPDJGKLCLJBCTBJDDBBLBLCZQRPPXJCJLZCSHLTOLJNMDDDLNGKAQHQHJGYKHEZNMSHRP
[QQJCHGMFPRXHJGDYCHGHLYRZQLCYQJNZSQTKQJYMSZSWLCFQQQXYFGGYPTQWLMCRNFKKFSYYLQBM
QAMMMYXCTPSHCPTXXZZSMPHPSHMCLMLDQFYQXSZYYDYJZZHQPDSZGLSTJBCKBXYQZJSGPSXQZQZRQT
BDKYXZKHHGFLBCSMDLDGDZDBLZYYCXNNCSYBZBFGLZZXSWMSCCMQNJQSBDQSJTXXMBLTXZCLZSHZCX
RQJGJYLXZFJPHYMZQQYDFQJJLZZNZJCDGZYGCTXMZYSCTLKPHTXHTLBJXJLXSCDQXCBBTJFQZFSLTJBTKQBX
XJJLJCHCZDBZJDCZJDCPRNPQCJPFCZLCLZXZDMXMPHJSGZGSZZQLYLWTJPFSYASMCJBTZKYCWMYTCSJJLJC
QLWZMALBXYFBPNLSFHTGJWEJJXXGLLJSTGSHJQLZFKCGNNNSZFDEQFHBSAQTGYLBXMMYGSZLDYDQMJJ
RGBJTKGDHGKBLQKBDMBYLXWCXYTTYBKMRTJZXQJBHLMHMJJZMQASLDCYXYQDLQCAFYWYXQHZ "
// Get it!
ls_ReturnStr = ""
Exit
End if
Next
End if
End if
End if
Next // processed
// Return result
end function
Avoid head side table // Grid data window selection mode when there form lines.
Grid data window with a way to achieve a tabular report output, but if not controlled or treated at the
head table side, it appears
Form Line Detail Band of each column of data, which we do not need. Reference method is to solve the
problem:
①. Could head side table in the Header Band of adding a text box, so that the text box and can be wide
enough to cover all of the data columns, while the
Vertical length adjustment Header Band in the head portion of the table flush.
②. Properties ... in the text box window, displays the contents of the text box to clear empty,
background Font tab in the font in the
Colors (Background) with the same background color is set to the data window and Position tab will be
its Layer (level) is amended as
Foreound, click the OK button, and immediately be able to see the effect.
With resource sharing and real-time communication needs, many computer applications have already
bypassing individual combat mode, into joint action.
Network in the computer world, increasingly play a pivotal role. In WINDOWS applications, most
commonly used for real-time communication
MICROSOFT WINSOCK control or provided by the company. Much of the information detailing the
WINSOCK in VB to use, even WINDOWS
Hlp file itself is also written for VB. The author because of the need of practical application, figure out the
application WINSOCK control in the PB of
Methods. Good things did not dare to enjoy alone, come to share with you.
Following a simple program to illustrate the use of the PB WINSOCK control of:
Insert control labels, selected from the list box, double-click the Microsoft Winsock control, the winsock
icon attached to the window.
The control name in the program as winsock_a (Party) and winsock_b (B).
Add a button cb_1 in the window, two-line text box sle_1, sle_2, respectively, the input string to send
and accept each other for sending
String
WINSOCK control allows the user to UDP and TCP Choose one of two protocols for communication.
1.UDP protocol settings: UDP protocol is a connectionless protocol, before the communication, the need
to bind remotehost and remoteport
Party A (the machine address is: 134.1.1.1) Open event window add the following statement:
winsock_a.object.protocol = 1
winsock_a.object.remotehost = "134.1.1.2"
winsock_a.object.remoteport = 6000
winsock_a.object.localport = 6001
winsock_a.object.bind
// Binding protocol
Open event of the window to add the following statement: In the B (134.1.1.2 address of the machine):
winsock_b.object.protocol = 1
winsock_b.object.remotehost = "134.1.1.1"
winsock_b.object.localport = 6000
winsock_b.object.bin
// Binding protocol
Party A (as a server-side) Open event window add the following statement:
winsock_a.object.protocol = 0
winsock_a.object.localport = 6001
winsock_a.listen ()
// Start listening
winsock_a.close ()
end if
winsock_a.accept (requestID)
winsock_b.object.protocol = 0
winsock_b.object.remotehost = "134.1.1.2"
winsock_b.object.remoteport = 6000
3 Either protocol uses, should add the following statement in the Close event of the window:
winsock_a.close ()
end if
Add the following sentence at the button cb_1 (caption attribute is set to 'send')'s click event:
winsock_a.object.send (sle_1.text)
string datastr1
The above procedure is actually reflects the underlying chat works, minor modifications can be made to
expand a nice chat software