Senin, 25 Mei 2009

NAMING CONVENTION IN POWERBUILDER

As in many programming languages , naming conventions have emerged.The management of many objects becomes imposible if they are not named according to convetion.Naming convetions are particulariy important when working in a them with other developers.

While your organization very likely will have its own naming conventions, there are several dlfauts that are used in powerbuilder. You are not forced to us these defaults but most developers do.

Naming Convention for Object

These prefixes may appear as defaults when you create an instance of these object
Type Of Object Prefix
Window w_
Menu m_
User Object u_
Datawindow dw_
Function f_
Structure s_
Query q_
Project p_

Naming Convention for Control
When you place one of these controls in a window for the control.

Type Of Control Prefix

Checkbox cbx_
Commandbutton cb_
Editmask em_
Dropdownlistbox ddlb_
Groupbox gp_
Radiobutton rd_
Singleline edit sle_
Statictext st_

Minggu, 24 Mei 2009

Windows

Windows can be built in tw ways. You can either build a new window from scratch, or you can build a windo that inherits some of its characteristics from an existing window. INHERITANCE is described later. Inheritance can be a powerful time saving tool if it used correctly. The following types windows are used in power builder:
• Main
• Respone
• Popup
• Child
• Multiple Document Interface frame (MDI)
• MDI frame with Microhelp

Main Windows are stand alone windows that are independent from all other windows. You can use main window as the anchor for your application.
Respone Windows are used to get repone from the user. A typical respone window is sometimes known as dialog boxes they enter into a dialog with user.
Popup Windows are often to display additional information on a screen inside a window that already open. They are useful from the point of view that they operate under the jurisdiction of parent window which takes care of a lot of the window management problems.
Child Window are similar to popup windows in that they exist only within a parent window. Chiled window have tighter link with the parent window.
MDI or MDI with Microhelp Window is used to open multiple windows, called sheet, within a single parent window. The user is able to move freely from sheet to sheet and take care of a lot of the tricky window management issues for the programmer, such as closing all of the MDI windows when the parent is closed. MDI frame window is a window with several part a menu bar, a frame, a client area etc.

Characteristics of PowerBuilder Objects


There are several character of powerbuilder objects that are under programmer control, they are :

• Attributes
• Events
• Scripts

Attributes are the properties of an object that control how it appears and how it behaves. They are frequently called properties in powerbuilder. Each different class has properties which are peculiar to that class. Properties can be define by he programmer when she is designing the system. They can also be change while the program is running.

Events are thing that can happen to an object. When you write come script to handle an event for an object, it is called trapping the event. Three event that are commonly trapped are the clicked event, the open event and the close event. You might be write some script associated with the clicked event of a command button. Thie code would be called when the button was clicked.

Script are the blocks of code that are stored inside each object. Unlike structure programming environments, there is no concept of a single contigoues program in powerbuilder. Instead the script reside inside an object. The are associates with evens for that object and are what governs the behavior of the application.

Rabu, 15 April 2009

Dropdown Data from Table ( PHP script)

()

Sintax :

select.....
php quote

if ($edit==1)
{
$perintah="SELECT * from tm_jabatan where kd_jabatan='$kd_jabatan';
$hasil=mysql_query($perintah);
while ($row=mysql_fetch_array($hasil))
{
$kd_jabatan=$row["kd_jabatan"];
$nm_jabatan=$row["nm_jabatan"];
echo("");
}
}

$perintah="SELECT * from tm_jabatan where stat_jab='1' order by kd_jabatan";
$hasil=mysql_query($perintah);
while ($row=mysql_fetch_array($hasil))
{
$kd_jabatan=$row["kd_jabatan"];
$nm_jabatan=$row["nm_jabatan"];
echo("");
}

php quote

end select

Senin, 13 April 2009

Dropdown Listbox ( PHP script)

pembuka select .......
// // if ($editx==1)
// switch ($kd_hid_level)
// {
// case "0" :echo('Kantor Pusat / Kantor Wilayah');break;
// case "1" :echo('Divisi / Kantor Cabang');break;
// case "2" :echo('UPC');break;
// }
// echo("");
// }
// echo("UPC");
// ?>
penutup /select..

Senin, 06 April 2009

number of row ( PHP Script)

$perintah2="SELECT * FROM .........";
$hasil2=mysql_query($perintah2) or die('Tidak ada data');
$n_data=mysql_num_rows($hasil2);
if ($n_data==0)
{
.......................;
}

Select Date Now from MySQL

$perintah="select DATE_FORMAT(now(),'%Y-%m-%d') as tgl_periode";
$hasil=mysql_query($perintah) or die($perintah);
while ($row=mysql_fetch_array($hasil))
{
$tgl_periode=$row["tgl_periode"];
}