Solved

PowerBiulder Window Object

Posted on 2003-11-29
8
2,296 Views
Last Modified: 2013-12-26

Hello,

I want to set some common properties for all the child windows in an MDI application. I want to make the ControlMenu off for the
child window when it is not in focus and again On when it is at the top. Is there any standard procedure available for this in PB or which event can be used for this?

How to display ScrollBars for the MDI window? I have set the HScrollBar & VScrollBar property to True but it is not appearing on screen while running. what additional property settings i have to do
for this?

Can we make CommandButton Text Multiline in PB?
0
Comment
Question by:sumitad
  • 4
  • 3
8 Comments
 
LVL 2

Expert Comment

by:mdhampton
Comment Utility
1) Normally, you would inherit new window object, and set the properties that you want in that window. For base code like enabling/disabling on focus, you would also create code in this new window object for that. Then, you would inherit from that base window when create all of the child windows.

1b) As for the focus, this would be rather difficult, as you would also need to see if any of the child objects on the window have focus, or has the entire window lost focus. You may be able to make use of the activate event to determine if you are active, but I have no idea about when you lose focus...

2) The scroll bars will appear and disapppear as needed, automatically. If this doesn't seem to be working, it probably is ; If a MDI child window is not displaying the scroll bars, it is because none of the objects on the window are "off of" the surface of the window. If the MDI frame window is not displaying the scroll bars, it is because none of the children are being clipped, or the windows that are being clipped are not MDI child windows.

3) Yes, but only with a picture button.
0
 

Author Comment

by:sumitad
Comment Utility
Hi,

Thank you for previous solutions.

1. How to get the Application's current path at runtime? I want to set Icon for each screen at runtime. I have set the Icon proeprty design time and the Icon file is copied in the current location but if I run the application on another machine, it does not display the icon. Is there any property to get the current path like the one in VB 'App.Path' ?

2. How to display Records in table format in a DataWindow Control ? I have created one DataWindow Object and it is linked to a DataWindow Control in another window, but after running the application nothing is displayed in the DataWindow Control except the column headings. what is the right procedure for this ? and what are the basic steps required for Database(Oracle,SQL Server) Connectivity (both designtime & runtime) through PB?

3. Can we use DataWindow object only for database applications? Which is more better using a DataWindow Object or a DataWindow Control?
0
 

Author Comment

by:sumitad
Comment Utility
Hi,

Thank you for previous solutions.

1. How to get the Application's current path at runtime? I want to set Icon for each screen at runtime. I have set the Icon proeprty design time and the Icon file is copied in the current location but if I run the application on another machine, it does not display the icon. Is there any property to get the current path like the one in VB 'App.Path' ?

2. How to display Records in table format in a DataWindow Control ? I have created one DataWindow Object and it is linked to a DataWindow Control in another window, but after running the application nothing is displayed in the DataWindow Control except the column headings. what is the right procedure for this ? and what are the basic steps required for Database(Oracle,SQL Server) Connectivity (both designtime & runtime) through PB?

3. Can we use DataWindow object only for database applications? Which is more better using a DataWindow Object or a DataWindow Control?
0
 
LVL 2

Accepted Solution

by:
mdhampton earned 40 total points
Comment Utility
1a) Icons and pictures are a pain. In design mode, you should place all of the pictures in the same folder as the .PBL's. When you select a picture, make sure that the path to the file is removed. Them include the pictures in a .PBR file so that it is included in the .EXE. This will get rid of the problems you are having with the pictures.

1b) For this, there are two answers. When you are running the application through powerBuilder, there is no easy way. However, when running as an .EXE, you can call the windows API GetModuleFileName. Let me know if you want an example of this; Calling API functions is not as simple as you would think. (see online books. The online help has little information).

2) In the application, you need to tell the datawindow a couple of things: What transaction object to use (via SetTransObject()) and what to do (Retreive data from the database, or Retreive (), insert new rows via InsertRow (), delete rows via DeleteRow ()). To connect, you need to populate various properties of a transaction object and then connect to the database.

3) You will use both, as well as probably datastores (non-visual datawindows). The datawindow object is used to tell a datawindow control or a datastore how to get its data. You can't use a datawindow object by itself. You can create datawindow objects that are not tied to a database by choosing external as the source.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Expert Comment

by:UsamaRazi
Comment Utility
2. The method of displaying records in datawindow is that
    Select 'tabular' or 'grid' form instead of 'free form' while designing datawindow object.
    The records are not shown because maybe you have not connected to database.
    The database connectivity code is like that
// No matter what database you are using, just create DSN and hard code the following.

SQLCA.DBMS = "ODBC"
SQLCA.AutoCommit = False
SQLCA.DBParm = "ConnectString='DSN=[DSN name];UID=[user id]; &
             PWD=[password]'"
connect using sqlca;
// then type datawindow control name in place of dw_1
dw_1.settransobject(sqlca)
dw_1.retrieve()

3. Datawindow object provides you manipulate and display data but does not provide the user interface. It means that if you are developing application, you require user interface and for user interface you should use datawindwo control.
0
 

Author Comment

by:sumitad
Comment Utility
Hi,

Thanks.

For setting icons will the solution 1a) work fine ? because i have copied the icon files in the .PBR file and it is in the same folder where the exe file is, but still it is not displaying the icon on any other machine though it is displayed on the native machine.

I will be grateful to you if you give me the example for calling Windows API function.

can you please suggest us a good book for PowerBuilder 8.0, for developing client-server application and database handling in PB.

Regards
Sumita


 
0
 
LVL 2

Expert Comment

by:mdhampton
Comment Utility
The Icon files and .PBR file need to be in the same folder as the .PBL files when you compile the application. The big thing is to make sure that when you select an Icon or bitmap when in design mode that you remove all path information. In the project painter, make sure that you put the .PBR file in the "Resource File Name" entry field underneath the Executeable File Name. (The .PBR file is only used at compile time). Also, Make sure that there is no path to the application's icon in the Icon Name field of the Application Object's Icon file.

To call an external function, you need to declare it as either a local external (e.g., local to the object you are working on) or global. To get to this area, open up an object (window, nvo, etc) and either click on the Declare Instance Variable tab or click on View, Variables menu. On the Drop down that is displaying "Instance Variables", pick "Local External Functions", and enter this function prototype on one line:

function long GetModuleFileName (long ah_module, ref string as_fileName, long al_filenamesize) library "KERNEL32.DLL" alias for GetModuleFileNameA

Then, to call it in script, you will need to do the following:

long ll_ret
string ls_filename

ls_filename = space (261) // pre-allocate memory for return value
ll_ret = GetModuleFileName (0, ls_filename, 260)
if ll_ret = 0 then
   // function failed!
//   ll_ret = GetLastError ()  -- external function, declared as
// function long GetLastError () library "KERNEL32.DLL"
// at this point, ll_ret has the error code
end if

Note that in the above code, I commented out the error code; If you want it be sure to add the external function declaration for GetLastError.

I haven't looked arround at any of the powerbuilder books since the 5.0 days, so I can't help with that. I am pretty sure that most of them are OK, and any by Bruce Armstrong or William Green will be good (long time powerbuilder writers).
0
 

Author Comment

by:sumitad
Comment Utility
Hi,

Thanks for the solution.

How to bring cursor in a SingleLineEdit control when clicked? we have designed some user interface windows and we have set TabOrder for each control in the window, but cursor appears in the SingleLineEdit cotnrol if it is focused by Tab key only. i.e. once the control loses focus and if we click on it by the mouse pointer, cursor doesn't return there. We are able to navigate through the feilds on the screen only using Tab key. what to do? Is there any event for the same?

We are getting an error for opening a window in the application both at runtime and designtime. the error is:

1. PB Application execution error R0011
   Error: Object file w_rm_telephone_consultation is out of date, must be    
   converted to current version at line 1 in clicked event of object
   cb_review_telephone_consult of w_rm_riskmgmt.
2. Invalid Object
The window is inherited from some other window which has been modified. after modifying the window we have regenerated both the window files but still it is giving error.

Now we have added the same window by importing the .srw file and it is working, but why such problem arises and what is the solution for the same?

Regards.
Sumita
 
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now