March 18, 2023

PowerBuilder Manual Book Part 1

PowerBuilder Curriculum Part 1

I. Development Specifications

1. Variable naming rules

The following uses global variables as an example

variable typeNaming rules
Booleangbl_
stringgs_
intgi_
uIntgui_
longgl_
longlonggll_
dategde_
timegtm_
datetimegdt_
decimalgdc_
decimal{2}gdc2_
chargc_
Doublegdb_

2. Component naming rules

describeComponent full nameNaming rules
windowWindoww_
data windowDataWindowdw_
d_
dddw_
structureStructures_
st_
menuMenum_
global functionFunctiongf
window functionWindowFunctionwf_
class functionClassFunctionof_
class functionCustomClassucc_
custom classStandardClassusc_
standard classCustomVisualucv_
Visualization classExternalVisualuev_
external visualization classStandardVisualusv_

3. Regional access rights

4. Variable access rights

5. About Notes

6. String typesetting

7. Chain operation

  1. First define 3 classes (uo_1, uo_2, uo_3)
  2. Define uo_2 u2 in the instance variable area in the uo_1 class
  3. Define uo_3 u3 in the instance variable area in the uo_2 class
  4. Create the of_init operation in the uo_3 class and return ‘success!’
  5. Start the chain operation call
    In the open event under the newly created w_main window, write the following code

II. System related

1. Registration and release of DLL

(1), register the dll in the System32 directory

(2), register the dll in the Syswow64 directory

(3), register the dll in other directories

(4), register all dll

(5), cancel the registered dll

2. Detailed definition of DLL

Use library to declare dynamic library

1. The function declaration of the common standard library DLL:

2. If it is a DLL of a version below PB9, when upgrading to a higher version, it will automatically add ;ansi, which becomes:

3. Definition of PB10 and above:

Note that ;ansi is not added, but the last A is changed to W, indicating that the UNICODE encoding is used.

Use system library to declare dynamic library

The difference between library and system library definitions

Library (foreign workers) system library (PB own people)
In fact, all the functions we use in PB exist in PBVMxxx.DLL in the form of system library.
For example: If you don’t like the name MessageBox, you want to use the name MsgBox, and all functions should be the same.
A function can be declared like this:

Benefits of using system library definitions

For functions declared in system librar mode, PB will not automatically add “;ansi” even if it is upgraded from PB9 to a higher version, which is convenient
Subsequent upgrade and maintenance

III. window

1.Branch statement and loop

(1). if

(2), choose

(3), try

(4), for

(5), do until

(6), do while

(7), continue, exit, goto

(8), null

2. Event

eventdescription
activateOccurs before the window is activated. After this event occurs, the object with the smallest sequence number gets the focus. If there is no sequence number, the window itself gets the focus.
clickedOccurs when the user clicks an empty area of the window that cannot contain any space or data windows
closeOccurs when the window is closed. After triggering this event, there is no way to prevent the closing of the window Occurs when the window starts to close. This event returns a return value of 0 or 1. If
closequerythe return value is 1, the window is not closed, and the close event will not be generated. If the return value is 0, the window is closed.
deactivateOccurs when a window becomes inactive
doubleclickedOccurs when the user double-clicks an empty area of the window that cannot contain any space or data windows
dragleaveOccurs when a draggable object or control leaves an empty space
dragwithinOccurs when a draggable object, or control, is dragged in the window
hotlinkalarmOccurs when the Dynamic Data Exchange (DDE) server application has sent new (modified) data and the client DDE application has received the data
keyOccurs when the user presses a key on the keyboard and the insertion point is not in the editing area
mousedownEmpty space, which occurs when the mouse is left-clicked. This event is the same as the click event, the value of flags is always 1
mousemoveOccurs when the mouse is moved in the window
mouseupOccurs when the left mouse button is released
openOccurs after the window is opened, but before the display
rbuttondownEmpty space, occurs when the right mouse button is pressed
remoteexecOccurs when a DDE client application sends a command
remotehotlinkstartOccurs when a DDE client application wants to start a hotlink
remotehotlinkstopOccurs when a DDE client application terminates a hotlink
remoterequestOccurs when a DDE client application requests data
remotesendGenerated when a DDE client application has sent data
resizeWhen the window size changes, this event is also triggered when the window is opened
systemkeyOccurs when the insertion point is not in the edit box and the user presses [alt] or [alt+other key combination]
timerCall the timer function to start the timer and set the time to occur
toolbarmovedOccurs when a toolbar in an MDI window is moved

3. Parameter transmission and reception

(1), string

(2), value

(3), structure

(4), User Object

(5), exe

(6), send messages and receive messages

(7), visual class value passing

4. Triggering events and functions

(1), trigger immediately

(2), triggered at the end of the event queue

(3) Dynamic binding trigger

Note:
The difference between dynamic call and static call
Static call is to compile the function completely when compiling the code
Dynamic call is to go back to find and call the corresponding function when the program is executed

(4) Trigger an event within the specified time

5. Various time acquisition

6. Cursor

(1), for

(2), do while

7. Stored procedure

(1), processing the result set

(2), process return value

8. Execute the sql statement directly in pb

9. Error reminder and pop-up window

(1), custom program error reminder

In the systemerror event of the current application, add the following code

(2), pop-up window

10. Shortcut keys

Key-value comparison Table

Alphabetic and numeric keyskeys of the numeric keypadfunction key other keys
keykey codekeykey codekeykey codekeykey code
A65096F1112Backspace8
B66197F2113Tab9
C67298F3114Clear12
D68399F4115Enter13
E694100F5116Shift16
F705101F6117Control17
G716102F7118Alt18
H727103F8119Caps Lock20
I738104F9120Esc27
J749105F10121Spacebar32
K75*106F11122Page Up33
L76+107F12123Page Down34
M77Enter108End35
N78109Home36
O79.110Left Arrow37
P80/111Up Arrow38
Q81Right Arrow39
R82Down Arrow40
S83Insert45
T84Delete46
U85Help47
V86Num Lock144
W87      
X88      
Y89      
Z90      
048      
149      
250      
351      
452      
553      
654      
755      
856      
957      

11. Access the web address

12. Display the name of the window being edited

13. Others

(1), allocate space to variables

(2), locate the breakpoint position

(3), get the current project path

(4), read and write ini files

(5), create and delete objects

(6), database connection and disconnection

(7), transaction commit and rollback

(8), set the control focus

PowerBuilder Manual Book Part 2 ClickHere

Good Luck!

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x