PowerBuilder FAQ

How to number groups?
How do I make powerbuilder interpret dynamically generated scripts?
How to determine the size of an object?
How do I know if an object exists in the libraries without calling LibraryDirectory?
How to cross PowerBuilder with Perl?
How to make DDDW with parameter?
How to find a string with specific values ​​in DW fields?
How to retry one line?
How to get the text value of the current line in DDDW?
How do I switch between keyboard layouts?
How to move along DW with Enter?
How do I create shortcuts? (* .lnk)
How to recalculate lines in a group?
How to number lines in a group?
How to install pb without ASA?
How do I know if an application is running from the development environment?
How to get the values ​​of dw fields, including calculated ones?
How to fire a KeyPress event on the active DWControle
External Functions
Using standard C / C ++ functions
Glitches when importing data into dw in querymode
Accessing subreports in composite DW
Oracle Stored Procedures as Data Sources for DW
How to avoid errors with different decimal separators
How to check the value returned by the parent script in a script
Web PB Problems
About keystrokes in the builder
Is it possible in PB 6.5 to get a list of windows and dws available in the program?
I would like to get the SQL query on which some DW is based
About datawindow
Tell me where you can read about the minimum shared dll required to install the program
Is it possible to write a program in PB that would support multi-threading within a single task?
Is it possible to somehow determine from the application the name of the directory from which it was launched (full name of the executable module with the path)? < / a>
Open report
Indirect Variables
Russian encoding in Jaguar
Checking fields before closing the form
How to get the Computed field value
How to best extend PFC
Programming Style
Are there all the constants listed anywhere for the 'special' background colors of controls in dw?
'Secret Bookmark' in PowerBuilder 7 :)
Highlighting the active line dw
dw and Oracle Stored Procedures

Question: How to number groups? "Konstantin Goldobin" reported / reported the following in the news: GB> I slow down again ... There is a standard group DW, I want to headline GB> group to put a calculated field so that it can show the number GB> groups in the report. cumulativeSum (1 for all distinct )
Q: How do I get powerbuilder to interpret dynamically generated scripts? A> People where you can find an interpreter written in PowerBuilder, A> and it would still be great if PB himself would somehow be able to interpret A> your scripts from the line with the source. I can suggest for PB6 (I have not tested it on other versions): You create a PBL with a set of functions (you can use objects), include it in the project so that compiled as PBD. After compilation, you throw away this PBD, use PBL. It must of course be included in setlibrarylist (). The functions of this PBL, which are called from the compiled project, can be entered changes "on the fly", without recompiling the project. The rest depends on the flight of imagination;) The PB user does not need to install at all, but enable some DLL from PB will still have to have something to edit the interpreted part programs... Best regards, Andrey. E-mail: alpharegul@ukrpost.net ORCA API. In particular, the PBORCA_CompileEntryImport function. Allows to import into PBL object presented as source text. Doesn't require PB installed as only one additional DLL is needed. Uses Callback and therefore requires a C ++ "wiring". Well, perhaps you also need to imagine a little about how PB works with PBL, pbd- for the changes to take place normally, you need to understand how to manipulate Get / SetLibraryList so as not to try to modify a file opened by PBVM. "Andrew Zorin"
Question: How do I determine the size of an object? Anatoly Moskovsky " reported / reported in the news the following: news: ... DS> This is probably the total size. PBORCA_LibraryEntryInformation dig. Exactly. DS> But it is impossible to call them from the Builder - PBVM is not reentrant ... Maybe at 5 and so, but starting from 6 - it is possible (except for callbacks, through them through helper DLL). global type s_entryinfo from structure character comments [256] long entrytime long objectsize long sourcesize end type function ulong PBORCA_SessionOpen () library "pborc60.dll" function long PBORCA_LibraryEntryInformation (& ulong hOrca, & readonly string as_lib, & readonly string as_entry, & long ai_type, & ref s_entryinfo info & ) library "pborc60.dll" ulong hOrca hOrca = PBORCA_SessionOpen () If hOrca = 0 Then MessageBox ("", "SessionOpen failed") halt End IF s_entryinfo ei long ret ret = PBORCA_LibraryEntryInformation (hOrca, "main.pbl", "app", 0, ei) If ret <0 Then MessageBox ("", "LibraryEntryInformation failed:" + String (ret)) halt End IF MessageBox ("", String (ei.ObjectSize) + "~ r" + String (ei.SourceSize) + "~ r") halt
Q: How do I know if an object exists in the libraries without calling LibraryDirectory? VK> How to find out: does an object exist in libraries without calling LibraryDirectory? VK> I would like to create a kind of safe "CREATE USING" ClassDefinition cd String ls_class = "n_dynamic_class" cd = FindClassDefinition (ls_class) If IsNull (cd) Then // raise error Else objref = Create Using ls_class End IF
Question: How to cross PowerBuilder with Perl? Here you go:
http://sqlbatch.com/t/dl.cgi?prod=util&id=perllib

Question: How to make DDDW with a parameter? First you need to make a dw with a parameter for the dropdown list. Then, so that retrieve is not automatically called without a parameter for that dddw, it is necessary: Register the pfc_populateDDDW event: w_frame lw_frame lw_frame = gnv_app.of_getframe () SetPointer (HourGlass!) if (as_colname = 'yourcolumn') then if adwc_obj.RowCount () = 0 then adwc_obj.SetTransObject (SQLCA) adwc_obj.Retrieve (argumentForDDDW) end if if adwc_obj.RowCount () = 0 then adwc_obj.insertrow (0) end if Return adwc_obj.RowCount () end if return NO_ACTION Next, add a call to pfc_postopen: dw.inv_base.of_populatedddw ('yourcolumn')
Question: How can I find a string with specific values ​​in DW fields? Tell me who will implement the search function how. Interested in searching with incomplete value (for example aab *), how much the Find function was parsed it does not know how. 1. If * is in the middle of a line, then only match: dw.Find ("match (columnname, '^ aaab. * ccccww $')", 1, rowcount) 2. If at the end (beginning) of the line (for example aab *), then you can do this: ls_text = "firstchars" dw.Find ("Left (columnname," + String (len (ls_text)) + ") = '" + ls_text + "'", 1, rowcount) I think the 2nd way is faster. "Anatoly Moskovsky" 2nd answer: Match DataWindow expression function: Match (string, textpattern) "Ilya Bricker"
Question: How do I retry one line? tabular DW with something in there. By double click or by pimp "Eats" another window opens with the current record, but in the whole beautiful, so to speak, for editing / adding a new entry. Tell me schematically the implementation of this all. And how to make sure that after editing the second one is updated the first is to do a retreat after updating one record is somehow not solid;) Syntax dwcontrol.ReselectRow (row) Description Accesses the database to retrieve values ​​for all columns that can be updated and refreshes all timestamp columns in a row in a DataWindow control or DataStore. The values ​​from the database are redisplayed in the row.
Question: How to get the text value of the current line in DDDW? dw.describe ('evaluate ("LookUpDisplay (data_column)",' + string (dw.GetRow ()) + ')') "Nikulitsa Andrey"
Q: How do I switch between keyboard layouts? Any painter, (Decare) -Global External Functions you need to declare global functions: FUNCTION long LoadKeyboardLayoutA (ref string Lay, int Flags) Library "USER32" FUNCTION long ActivateKeyboardLayout (long Lay, int Flags) Library "USER32" Then create a function like this (the export file is given): $ PBExportHeader $ f_ruslat.srf $ PBExportComments $ RUS / LAT switching function global type f_ruslat from function_object end type forward prototypes global subroutine f_ruslat (string as_language) end prototypes global subroutine f_ruslat (string as_language); String ls_Lay long ll_Lay, ll_OldLay if left (lower (as_language), 3) = 'rus' then ls_Lay = '00000419' else ls_Lay = '00000409' end if ll_Lay = LoadKeyboardLayoutA (ls_Lay, 0) If ll_Lay> 0 Then ll_OldLay = ActivateKeyboardLayout (ll_Lay, 0) Else ll_OldLay = -1 end if end subroutine Now, to switch layouts, you can simply call f_ruslat ('rus') or f_ruslat ('lat')
Question: How to move along DW on Enter? > I would like to do the same as for TAB. The user event with Event ID: m_dwnprocessenter is hung on DW The script for this event: send (handle (this), 256.9, long (0,0)) return 1 Andrey.Protopopov@p20.f2.n5022.z2.fidonet.org Another answer: Almost the same, only without using send (...) and mysterious tsiferok :-) Almost the same UserEvent EventName EventID ue_enter pbm_dwnprocessenter And the script for processing it: int nCols nCols = Integer (this.Describe ("Datawindow.Column.Count")) // number of columns, you still have to subtract the invisible ones :-) // the real script was fixed. number... int nCurrCol, i nCurrCol = this.getcolumn () // current column i = nCurrCol + 1 // do not follow TabOrder, but as we wish, here - on next DO WHILE (this.Describe ('#' + String (i, '0') + '. Visible') = '0') AND i <= nCols i ++ LOOP // missed invisible ones (here you can reset the nCols counter) if i> nCols then // DW ended. Then go to sle_1 sle_1.SetFocus () this.SetColumn ('summa') this.ScrollToCol (1) else // here is the column navigation itself this.SetColumn (i) this.ScrollToCol (i) end if return (1) // so that Enter does not work to move down the column Worked on PB 4.0, works on PB 5.0 and 6.5, probably will live on 7.0 Lesha@aitsoft.dol.ru
Q: How do I create shortcuts? (* .lnk) Get here: http://www.pfcguide.com/extensions/ext_0014.asp
Question: How to recalculate lines in a group? last (getrow () for group 1) - first (getrow () for group 1) or sum (1 for group 1) Mark Lokshin & lt; Mark.Lokshin@p147.f3.n5025.z2.fidonet.org>
Question: How to number lines in a group? getrow () - first (getrow () for group 1) + 1 Andrey. E-mail: dsm@kolosov.dn.ua Another answer: CumulativeSum (1 for group 1) Dmitri Grichine dgrichine@mail.ru
Question: How to install pb without ASA? Probably the following will help - in the Registry in HKEY_CURRENT_USER \ Software \ SYBASE \ Adaptive Server Anywhere \ 6.0 create a string parameter "Language" with the value "en". (such an amendment is required for ASA 6.0.1, with the latest PB7 beta it was this version.) Roman V. Kabanov, rvk@rinet.ru
Question: How do I know that the application is launched from the development environment? Handle (GetApplication ()) returns 0 if the application is launched from under the PB environment.
Question: How to get the values ​​of dw fields, including calculated ones? 1) via dot notation dw_sheet.Object.computedName [1] 2) through describe ('evaluate ()') dw_sheet.describe ('evaluate ("computedName", 1)') dw_sheet.describe ('evaluate ("expression", 1)') etc. If nested dw: When you have a nested report in another nested, etc., then a lot it's easier to write dw_sheet.Object.dw1.Object ... than to take getChild a lot paz. Yes, and although I usually do not get the values ​​of computed fields, but the situation, when in big report getItem didn't work I had. Vlad.Ermolaev@p33.f16.n5025.z2.fidonet.org
Question: How to handle the KeyPress event on the active DWControle map to pbm_dwnkey On fingers (just in case) it looks like this: - create your userevent for DWControl - when creating you say Paste: pbm_dwkey - in the script of a freshly baked event, you check the "key" argument (possible variants of its values ​​are in the DownKey () help) - if you want to stop processing pressing (i.e. - so that the standard action after yours was not performed) - "Return 1" roma@pib.megastyle.com
Question: External Functions L> I tried to write an external function (DLL) on VC ++ 5 L> wrote cpp L> __declspec (dllexport) char WriteA (void) 1) It should be stdcall 2) Preferably extern "C" L> Compiled in CPAGE.DLL. L> Registered in PB 6.0 L> Function char WriteA () library "CPAGE.DLL" 2 1/2) ALIAS FOR "_WriteA @ 0" Another answer: This is where the maps are confusing C ++. Try compiling as C, or you have to do something like this: Function char WriteA () alias for "? WriteA @@ YADXZ" library "CPAGE.DLL" With VC6.0 this works Another answer: Describe your functions like this: #ifdef __cplusplus extern "C" { #endif void __stdcall (dllexport) far pascal yourfunc (void); .................................................. .. #ifdef __cplusplus } #endif Or you can still use the .def file in 5 vc not to use dllexport, for example: LIBRARY YOURLIB DESCRIPTION 'YOURLIB DLL' ; STUB 'WINSTUB.EXE' ; EXETYPE WINDOWS CODE MOVEABLE PRELOAD DISCARDABLE DATA MOVEABLE PRELOAD SINGLE HEAPSIZE 4000 EXPORTS yourfunc @ 1 ; WEP PRIVATE And all the cases. Nothing will be disfigured. And in dll it is desirable to write a load function- libmain for win16, or dllmain for win32. Let's say like this: #ifdef WIN31 /*win16*/ int pascal LibMain (HANDLE hInstance, WORD wDataSeg, WORD wHeapSize, LPSTR lpCmdLine) { hInst = hInstance ; if (wHeapSize > 0) UnlockData (0); return 1; } BOOL far pascal WEP (int bSystemExit) { return (1); } #else /*win32*/ BOOL APIENTRY DllMain( HANDLE hModule, DWORD dwReason, LPVOID lpReserved ) { switch( dwReason ) { case DLL_PROCESS_ATTACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return TRUE; } #endif
Question: Using standard C / C ++ functions Has anyone tried to reach the "CopyMemory" API? The fact is that it is non-exportable and with the usual external declaration function fails :( In general, the problem is this: I have an array Char c [8], where 8 bytes are stored, corresponding to the Duble number. How can these bytes "construct" a value for a builder variable of type Double? I don't want to mess with a separate DLL ... FUNCTION long pbstg_huge_memcpy (ref double a, ref string b, int c) library "pbvm60.dll" In principle, you can change the type of parameters. This is a standard C function. In the same way, you can reach any C ++ standard procedures. Vladimir Ritchkov
Question: Glitches when importing data into dw located in querymode KG> When I call the functions ImportString, ImportFile, ImportClipboard KG> for dw, which is in querymode, the data is put from the second line KG> dw. Has anyone fought? Won? By scientific typing (tested on ImportString), it turned out that the second the parameter of these functions is used in querymode as the line number in DW before which will be inserting data. So ImportString (ls_Data, 0) will save ... Konstantin Goldobin
Question: Accessing subreports in composite DW Let dw_composit_window be the name of the variable of the composite report, which contains a report whose name property is d_inside_window. In d_inside_window there is a label city_code_t, in which the following text changes the text property: DWObject InsideReport InsideReport = dw_composit_window.object.d_inside_window InsideReport.object.city_code_t.text = "!!!" Pretty much the same: DWObject InsideReport InsideReport = dw_composit_window.object.d_inside_window DWObject InsideInsideReport InsideInsideReport = InsideReport.object.d_inside_inside_window InsideInsideReport.object.city_code_t.text = "!!!" Or this, although it looks ugly: dw_composit_window.object.d_inside_window.object.d_inside_inside_window.obje ct.city_code_t.text = "!!!" (The previous answers have complaints about a runtime error) There is such an answer: We have an old project. (PB 5.0.4) This is how the following code works fine in it --dw_report - composite --dw_header - report DataWindowChild dw_h dw_report.GetChild ('dw_header', dw_h) dw_h.InsertRow (0) dw_h.SetItem (1, 'address', 'My address is not a house or a street') dw_h.Modify ("address.Height = 80") Personally, the following combination worked for me on pb7.0.3: (the point is that dwo is assigned not the nested report itself, but one of its controls) dwobject dwo dw_main.settransobject (SQLCA) dw_main.retrieve () dw_main.object.t_1.text = "aaa" // item in main dw // ---- here is the whole thing --------- dwo = dw_main.object.dw_1.object.user_t dwo.text = "bbb" // item in child dw // ------------------------------ t_1 - text mostly dw user_t - text in nested dw
Q: Oracle Stored Procedures as Data Sources for DW Create a test routine: CREATE OR REPLACE PROCEDURE USER1.P_TEST (A_DATE IN OUT DATE) AS BEGIN a_date: = to_date ('11 .11.1911 ',' DD.MM.YYYY '); END; Now I'm trying to create a dw that would retrieve data from the procedure: DW Painter -> New -> I choose Stored Procedure, Tabular I select my procedure from the list, press OK, an empty DataWindow appears (Untitled), with which nothing else can be done except close. :( Menu edit, objects, design, rows, buttons SQL, Preview, Save, Insert objects - locked The procedure for dw must return a certain result set :-) In short, with oraklovy procedures and DW there is some gimor. You need to use the ref cursor type, i.e. pointer to cursor by which you will return the result set you need to DW. The first parameter of your procedure will be a pointer-to-cursor variable. Well, in the procedure, you open this ref cursor and that's it. Next, dw will do fetch and close through the PB oci driver. Here's a batch for Sql Plus using your example: For oracle 7.2 (you must specify the type returned by the cursor) create or replace package mycur as type rectype is record (dt date); type curtype is ref cursor return rectype; end mycur; / create or replace procedure mydwproc (dwresultset in out mycur.curtype) is begin open dwresultset for select to_date('11.11.1911','DD.MM.YYYY') from dual; end; / Well, for Oracle 7.3 and higher, it's generally simple (the first one will also work :-)) create or replace package mycur as type curtype is ref cursor; end mycur; / create or replace procedure mydwproc (dwresultset in out mycur.curtype) is begin open dwresultset for select to_date ('11 .11.1911 ',' DD.MM.YYYY ') from dual; end; / PS: you stick datawindow essno to mydwproc :-) WBR, Oleg Another answer: > g> But if you use DYNAMIC SQL, then you can, I tried it myself > g> This feature is available since Oracle 8i > g> construct like OPEN c FOR USING ... > g> sql_string - a string that can be formed before this > And in more detail? Is there any sample? Unfortunately, right now, there is nothing real at hand, but here: CREATE OR REPLACE PACKAGE DYNAMIC_CURSOR IS TYPE T_REF_CURSOR IS REF CURSOR; PROCEDURE get_cursor(out_cursor OUT T_REF_CURSOR); END; / CREATE OR REPLACE PACKAGE BODY DYNAMIC_CURSOR IS PROCEDURE get_cursor(out_cursor OUT T_REF_CURSOR) AS BEGIN OPEN out_cursor FOR 'SELECT 10 num FROM DUAL UNION SELECT 11 FROM DUAL'; END; END; / CREATE OR REPLACE PROCEDURE GET_CURSOR(out_cursor OUT DYNAMIC_CURSOR.T_REF_CURSOR) IS BEGIN OPEN out_cursor FOR 'SELECT 10 num FROM DUAL UNION SELECT 11 FROM DUAL'; END; / You make a new DW, specify the last procedure, then export and replace procedure = "1 execute GET_CURSOR; 0" on procedure = "1 execute DYNAMIC_CURSOR.GET_CURSOR; 0" Importing back (all this was done and checked at the time of writing the letter PB7.0.2 (8021) Oracle8i Personal Edition Release 8.1.5.0.0 - Production With the Java option PL / SQL Release 8.1.5.0.0 - Production) I wrote myself a small program that builds DW by selection, and then substitutes the package there Sorry if I misunderstood the question and, accordingly, did not answer that. Dmitry Ibikus Another answer: Hello. I ask to respond those who solved the problem of combining the Builder with Orakl. The main question is to force DataWindow to see those stored procedures which are declared in packages, as a data source. On the Sybase site, I already was, but nothing suitable was found there, because you have to use CLOBs, and the fifth Builder has no idea what it is. Change version the bosses will go to the Builder only as a last resort - the working part of the system already on PB5, and talk about transferring all developments to the seventh it will be possible only if an acceptable method is not found turn it all on the fifth. So far, the technique seems to be the same: The ref cursor type declared in a separate package is used. You pass the cursor to the procedure by reference, which is _only in it open, the rest will be done by PB oci driver. This parameter will be swallowed by DW, the rest will be as normal arguments. Obviously, a similar procedure can be in package, but for DW you need to write another one that calls it outside package with the same set of arguments. For oracle 7.2 (you must specify the type returned by the cursor) create or replace package mycur as type rectype is record (dt date); --for example type curtype is ref cursor return rectype; end mycur; ----------------------------------------- For Oracle 7.3 and higher create or replace package mycur as type curtype is ref cursor; end mycur; ----------------------------------------- Procedure for DW: create or replace procedure mydwproc (dwresultset in out mycur.curtype) is begin open dwresultset for select to_date ('11 .11.1911 ',' DD.MM.YYYY ') from dual; --eg end; "NIISA" niisa@dialup.ptt.ru
Question: How to avoid errors related to different decimal separators parts of numbers (.,) There is a server 7.3.3. I have a field number (3,1) in the table. In PB (PowerBuilder 6) - DW object has this field, set a mask for it and the format is "# 0.0". If the value 0.5 sits in the table, then PB shows in cell DW 5.0, If the value 2.0 sits in the table, then PB shows DW 2.0 in the cell, If the value 1.5 sits in the table, then PB shows in cell DW 15.0 Try to run the command in the database administrator alter session set nls_numeric_characters = '.,'; And then re-read DW. Sometimes it helps. Alexander
Question: How to check the value returned by the parent script in a script First, check if you have checked the Override ancestor script checkbox. It turns on automatically if you created an ancestor event script after script of the successor. In the script of the successor: If AncestorReturnValue <> 1 Then // your actions Else Return AncestorReturnValue End If
Question: Problems with Web PB I have such a problem: it seems like I would set everything up, but when you call method on the client (MS IE 4) I get the message: Error: PBWEBSetConfig: Could not find definition for Server Alias '& lt; server_alias & gt;'. PBWEBRunRequest: PBWEBSetConfig has failed. As far as I understand, binding Server Alias ​​to the name, sobssno, server applications is in the pbweb.ini file (it is still in different places docks call pweb.ini, webpb.ini). In this inishnik I have everything described as it should !!! Example from my PBWEB.INI: [idkdemo] application = pb_net_examples location = localhost driver = winsock [Cert-Rep] driver = winsock application = 70000 location = 175.210.135.63 > Maybe Web.pb doesn't find this initiator ??? Where should he lie ??? I live in C: \ WINNT, and it seems to find everything. Look at the RUNEXAMP.HTM file, it is installed with WebPB, it details all the necessary settings. Roman V. Kabanov, rvk@i.am
Question: About keystrokes in the builder In general, this is how I solved this problem 1) I have a User Object of DDLB type - this is how you map the event in it pbm_cbneditchange to something of your own - for example ue_char_key_press and inside it we do something like ue_char_key_press ------------------- int li_proccess = 0, ls_idx = 0, li_start string ls_txt = '' ls_txt = this.Text li_start = len (this.Text) ------------------------------------- Here you can also play with the system events pbm_enupdate, pbm_enchange One of them happens BEFORE another AFTER the key is pressed 2) In dw, the pressed key is easily determined via pbm_dwnkey And also the standard editchanged event reacts to each pressed key Best regards, Leonid mailto: leo@softincom.ru More on this: AN> What were you thinking? ;-) I think it's hard to do even better on the Builder I thought that somehow it is possible. AN> something. Can be tried through the Windows API. No, it will not work - it is not clear how to catch the event. Damn, you read a lot here ... Hook on the keyboard, API, event other ... In Builder you can do whatever you want, if not be perverted unnecessarily. In my time the search service when typing was written by me in two days without the slightest reflection. Case - so case, take DynaText, copy the keycode list from it, translate into Russian (Ukrainian to taste), add a little powerscript (of course, in ultraedit), everything is ready, an hour of work. Him (PB) no equations to decide on speed, why invent something? Yes, you'll be writing a service, take a look at n_cst_dwsrv_dropdownsearch from the PFC. it not what you want, but the easiest way is to start from it. In outline, you don't have to write anything, just replace DDDW with edit and remove all unnecessary :-) [skipped] I want to make a component based on DataWindow that would implement this opportunity, but for a couple of days I can't find a way to do it not through a known place. It is very likely that this is where you started. Why do you need ASCII here if everything equally cast to string, since must be compared with the contents of the screen buffer (mapping) a field? Catch Case, if you need ASCII, not string, go through some editor with good replace or handles. In general, my search service when typing works, great, I can share, but I can't post here, because now there is no direct access in Fido, and in it> 35K of text (I ask you not to be scared, half of them are comments, copyrights and terms of use), in zip 5K, but the kindest server through which I go, not understands attachments. So ask someone who has an email address, send a zip here, or, if the moderator allows, I will send the text ... ////////////////////////////////////////////////////////////////////////////// // // Function: n_cst_string::of_string // // Arguments: // // Returns: string // // Description: // // Note: // ////////////////////////////////////////////////////////////////////////////// // // Modifications: // // Date Author Comments //---------------------------------------------------------------------------- // 16.03.00 V.Kolodiazhnyi Created ////////////////////////////////////////////////////////////////////////////// String ls_null If IsNull(key) Then SetNull (ls_null) Return ls_null End If //Russian Character set if Layout = LAYOUT_RUSSIAN then if KeyFlags = 0 then Choose Case key Case keya!; Return 'ф' Case keyb!; Return 'и' Case keyc!; Return 'с' Case keyd!; Return 'в' Case keye!; Return 'у' Case keyf!; Return 'а' Case keyg!; Return 'п' Case keyh!; Return 'р' Case keyi!; Return 'ш' Case keyj!; Return 'о' Case keyk!; Return 'л' Case keyl!; Return 'д' Case keym!; Return 'ь' Case keyn!; Return 'т' Case keyo!; Return 'щ' Case keyp!; Return 'з' Case keyq!; Return 'й' Case keyr!; Return 'к' Case keys!; Return 'ы' Case keyt!; Return 'е' Case keyu!; Return 'г' Case keyv!; Return 'м' Case keyw!; Return 'ц' Case keyx!; Return 'ч' Case keyy!; Return 'н' Case keyz!; Return 'я' Case KeyQuote!; Return 'э' Case KeyComma!; Return 'б' Case KeyPeriod!; Return 'ю' Case KeySlash!; Return '.' Case KeyBackQuote!; Return 'ё' Case KeyLeftBracket!; Return 'х' Case KeyRightBracket!; Return 'ъ' Case KeySemiColon!; Return 'ж' End Choose else Choose Case key Case keya!; Return 'Ф' Case keyb!; Return 'И' Case keyc!; Return 'С' Case keyd!; Return 'В' Case keye!; Return 'У' Case keyf!; Return 'А' Case keyg!; Return 'П' Case keyh!; Return 'Р' Case keyi!; Return 'Ш' Case keyj!; Return 'О' Case keyk!; Return 'Л' Case keyl!; Return 'Д' Case keym!; Return 'Ь' Case keyn!; Return 'Т' Case keyo!; Return 'Щ' Case keyp!; Return 'З' Case keyq!; Return 'Й' Case keyr!; Return 'К' Case keys!; Return 'Ы' Case keyt!; Return 'Е' Case keyu!; Return 'Г' Case keyv!; Return 'М' Case keyw!; Return 'Ц' Case keyx!; Return 'Ч' Case keyy!; Return 'Н' Case keyz!; Return 'Я' Case KeyQuote!; Return 'Э' Case KeyComma!; Return 'Б' Case KeyPeriod!; Return 'Ю' Case KeySlash!; Return ',' Case KeyBackQuote!; Return 'Ё' Case KeyLeftBracket!; Return 'Х' Case KeyRightBracket!; Return 'Ъ' Case KeySemiColon!; Return 'Ж' //characters that depends from language only when shift key is pressed Case key0!; Return ')' Case key1!; Return '!; ' Case key2!; Return '"' Case key3!; Return '¦' Case key4!; Return ';' Case key5!; Return '%' Case key6!; Return ':' Case key7!; Return '?' Case key8!; Return '*' Case key9!; Return '(' End Choose end if else if KeyFlags = 0 then Choose Case key Case keya!; Return 'a' Case keyb!; Return 'b' Case keyc!; Return 'c' Case keyd!; Return 'd' Case keye!; Return 'e' Case keyf!; Return 'f' Case keyg!; Return 'g' Case keyh!; Return 'h' Case keyi!; Return 'i' Case keyj!; Return 'j' Case keyk!; Return 'k' Case keyl!; Return 'l' Case keym!; Return 'm' Case keyn!; Return 'n' Case keyo!; Return 'o' Case keyp!; Return 'p' Case keyq!; Return 'q' Case keyr!; Return 'r' Case keys!; Return 's' Case keyt!; Return 't' Case keyu!; Return 'u' Case keyv!; Return 'v' Case keyw!; Return 'w' Case keyx!; Return 'x' Case keyy!; Return 'y' Case keyz!; Return 'z' Case KeyQuote!; Return "'" Case KeyComma!; Return ',' Case KeyPeriod!; Return '.' Case KeySlash!; Return '/' Case KeyBackQuote!; Return '`' Case KeyLeftBracket!; Return '[' Case KeyRightBracket!; Return ']' Case KeySemiColon!; Return ';' end choose else Choose Case key Case keya!; Return 'A' Case keyb!; Return 'B' Case keyc!; Return 'C' Case keyd!; Return 'D' Case keye!; Return 'E' Case keyf!; Return 'F' Case keyg!; Return 'G' Case keyh!; Return 'H' Case keyi!; Return 'I' Case keyj!; Return 'J' Case keyk!; Return 'K' Case keyl!; Return 'L' Case keym!; Return 'M' Case keyn!; Return 'N' Case keyo!; Return 'O' Case keyp!; Return 'P' Case keyq!; Return 'Q' Case keyr!; Return 'R' Case keys!; Return 'S' Case keyt!; Return 'T' Case keyu!; Return 'U' Case keyv!; Return 'V' Case keyw!; Return 'W' Case keyx!; Return 'X' Case keyy!; Return 'Y' Case keyz!; Return 'Z' Case KeyQuote!; Return '"' Case KeyComma!; Return '<' Case KeyPeriod!; Return '>' Case KeySlash!; Return '?' Case KeyBackQuote!; Return '~~' Case KeyLeftBracket!; Return '{' Case KeyRightBracket!; Return '}' Case KeySemiColon!; Return ':' //characters that depends from language only when shift key is pressed Case key0!; Return ')' Case key1!; Return '!; ' Case key2!; Return '@' Case key3!; Return '#' Case key4!; Return '$' Case key5!; Return '%' Case key6!; Return '^' Case key7!; Return '&' Case key8!; Return '*' Case key9!; Return '(' end choose end if end if if KeyFlags = 0 then Choose Case key //characters that depends from language only when shift key is pressed Case key0!; Return '0' Case key1!; Return '1' Case key2!; Return '2' Case key3!; Return '3' Case key4!; Return '4' Case key5!; Return '5' Case key6!; Return '6' Case key7!; Return '7' Case key8!; Return '8' Case key9!; Return '9' //characters that don't depends from language Case KeyEqual!; Return '=' Case KeyDash!; Return '-' Case KeyBackSlash!; Return '\' End Choose else Choose Case key //characters that don't depends from language Case KeyEqual!; Return '+' Case KeyDash!; Return '_' Case KeyBackSlash!; Return '|' End Choose end if //characters that don't depends neither from language nor from keyflags Choose Case key Case KeySpaceBar!; Return ' ' Case KeyNumpad0!; Return '0' Case KeyNumpad1!; Return '1' Case KeyNumpad2!; Return '2' Case KeyNumpad3!; Return '3' Case KeyNumpad4!; Return '4' Case KeyNumpad5!; Return '5' Case KeyNumpad6!; Return '6' Case KeyNumpad7!; Return '7' Case KeyNumpad8!; Return '8' Case KeyNumpad9!; Return '9' Case KeyMultiply!; Return '*' Case KeyAdd!; Return '+' Case KeySubtract!; Return '-' Case KeyDecimal!; Return '.' Case KeyDivide!; Return '/' end choose //Invalid parameter Return ''
Question: Can I get a list of windows and dws in the program in PB 6.5? LibraryDirectory (libraryname, objecttype) further on help
Question: I would like to receive an SQL query that a certain DW is based on The easiest way is through the datastore Example: Datastore lds String ls_sql lds = Create DataStore lds.DataObject = "d_datawindow" lds.SetTransObject (sqlca) // if the request was made by hand, then this can not be do ls_sql = lds.GetSqlSelect () Destroy lds
Question: About datawindow My problem starts like this - I also change it for dw .dataobject, but besides this, I have a couple of such DWs that when start windows have .Visible = False, in the opening script it is decided which type data and DW view must be applied to the Datawindow object variable the name of the object of the desired dw-control is assigned IMHO this is not the best way - to overlay DWs, and switch when Hide / Show help. It is more rational to insert each of DW into UO, and when the window decides which DW to apply, it should execute openUserObject (). And in the constructor of each UO, you prescribe how to initialize DW. and can be changed if necessary .dataobject. It is better to change not the dataobject, but load the form from the PBL library: dw.Create (LibraryExport (libName, formName, ExportDataWindow!)) By doing this, you not only free up space in the EXE file, but also isolate yourself from all sorts of surprises, because ceate creates dw practically from scratch. In addition, you have the opportunity to correct and change the DW forms unintentionally while the program is running. So, all these DWs are on Externale and when you open a window in them Inserts the record, which I assign the default value through .object.data [,], for example for date - Today (). In this case, it is better to use the initial property or even better to type today in the initial value at the time of editing dw in dw palette. But! at the beginning of editing, the value of this line instead of "02/26/1999" - "00.00.0000". If the value is not changed, but moved to the next line, then the true value will become visible. It's kind of annoying, you start involuntarily enter the date, although it is there ... I met this in goggled windows, saved myself by juggling lines through setrow (0); setrow (lastrow) :( In general, IMHO, External is not very convenient from the point of view of design. I have recently given up on them altogether and have no regrets. If you need the "abstract window "without binding to a specific table, I create a SQL Select with a query type: select '' as name1, cast (null as date) as name 2, cast (null as double) as name 3, ............................. from dummy You use the same External, but: 1. The preview works fine 2. The names and types of fields change without any problems. 3. With a large number of fields, it is very convenient to work in the data source, and with the need for group replacement in the fields, the text from the data source can be copied into any text editor and after processing, paste it back.
Question: Tell me where you can read about the required minimum shared dll for program installation I found a description of ALL DLLs only for the 5th PowerBuilder on the old page Craig Wagner http://www.thehindu.co.in/INTRANET/software/powerbuilder/powerbuilder_faq.sHTML.htm answer number [2.1] Its updated page is here: http://www.mindspring.com/~craig_wagner/powerbuilder_faq.html but now answer [2.1] is significantly truncated. In the seventh PB, you still need to add DLL for Jaguar even if you don't need it. I think her name starts with lib .... Another answer: Required DLLs: 1. PBVM70.DLL - PowerBuilder Virtual Machine - the most important, without it nowhere. 2. PBDWE70.DLL - DataWindow Engine. If DW is not used, you can do without it. But on the other hand, what a PB dispenses with Datawindow? ? ? 3. PBSYC70.DLL - Native-driver for working with the database (in this case for Sybase ASE). Who uses other bases - accordingly other libraries. PBO8470.DLL - Oracle, PBIN970.DLL - Informix, see further in the documentation. 4. LIBJCC.DLL - support for Jaguar, an innovation of the seventh builder. Even if the program has nothing to do with Jaguar, the library you still need it, such a trick ... It was all about PB7. For PB6, the following is true: 1. PBVM60.DLL 2. PBDWE60.DLL 3. PBSYC60.DLL (or PBO7360.DLL, or PBIN760.DLL, or ...) Roman V. Kabanov, rvk@i.am
Question: Is it possible to write a program in PB that would support multiple threads within one task? on PB 5 - it is impossible. on PB 6.x - you can use Shared Objects. & lt; Excerpt from an example & gt; / * create runtime environments for thread * / SharedObjectRegister ('nv_test', 'object1') / * get poiner to the object * / SharedObjectGet ('object1', inv_Test1) / * start thread * / inv_Test1.POST of_Start () Andrey Zorin St. Petersburg, Russia ICQ UIN 2276239 mailto: azorin@email.com Welcome to #powerbuilder IRC channel (Undernet)
Question: Is it possible to somehow determine from the application the name of the directory, from which it was launched (full name of the executable module with path)? The directory name is defined like this: string ls_AppPath string ls_FullPath, ls_RevPath int li_Pos, li_Pos2 // get the full name ClassDefinition lcd n_dummy_obj u If IsNull (u) Then u = Create n_dummy_obj // if not autoinstantiated lcd = u.ClassDefinition ls_Fullpath = lcd.LibraryName // highlight the directory name ls_RevPath = Reverse (ls_FullPath) li_pos = Pos (ls_RevPath, "\") li_pos2 = Pos (ls_RevPath, "/") If li_pos2> 0 and li_pos> li_pos2 Then li_Pos = li_Pos2 End If If li_pos> 0 Then ls_AppPath = Left (ls_FullPath, Len (ls_FullPath) - li_pos) Else ls_AppPath = "." End IF return ls_AppPath Instead of "n_dummy_obj", you can substitute any (almost) class that is in the executable module. So that when compiling the object fit into the EXE, you need to uncheck the "DLL / PBD" box in the project opposite libraries with this object. Although if all libraries are in the same directory, you don't need to worry about this. There is also another option (win32): You describe an external function: function long GetModuleFileNameA (long module, ref string path, long length) library "kernel32.dll" And then you call her: ls_Fullpath = Space (255) li_Ret = GetModuleFileNameA (Handle (GetApplication ()), ls_FullPath, 255) Here we have the full path to the EXE. Next, parsing the path as shown above. Although I like the first option better.
Question: Open report AK> And how to actually implement the subject from the application. AK> Something was not found in the manual. If the Report means a datawindow for printing so you open it as usual and set the property & lt; dataobject & gt; .object.DataWindow.Print.Preview = "Yes" (it seems so ) And if it lies in a separate PBL, which is not linked to the project, then so & lt; StringVar & gt; = LibraryExport (& lt; Library & gt;, "report name", ExportDataWindow!) & lt; dataobject & gt; .Create (& lt; StringVar & gt;, & lt; ErrorVar & gt;) ^^^^^^^^^ He writes a mistake here
Question: Indirect variables >> Described by Gallager on page 157 >> A variable can be declared so that reading and writing can be done through functions: >> Indirect & lt; type & gt; & lt; name> {& lt; write_procedure & gt; (* value), & lt; read_function & gt; ()} >> after & lt; name & gt; = Message.Powerobject will be called & lt; write_procedure & gt; > SS> If possible, in more detail. There is nothing about this in the help or in the online book > SS> no, there is only a reserved word, Experiments also gave nothing. > SS> Tried it on 6.5. Maybe this is a feature of the 7? Was still in 4-ke. Only worked poorly. Here's an example by convention: Intstance: long tn string s Indirect string Z {gt (* value), pt ()} // Possible only in Instance !!! procedure gt (int a) tn = a string function pt () & lt; Here, for example, the search for a surname by the personnel tn and entry in s & gt; return s Description: Using: Z = 1101 // Personnel sle_1.text = "Full name:" + Z // Last name Note that the Z variable does not exist at all. By the way, all structure elements are Indirect.
Question: Russian encoding in Jaguar Will anyone help with the next problem. Using PowerBuilder's COM Object to Generate HTML by calling it from ASP pages. So here is any element of the DW-object with Russian text in the browser (any and with any fonts) is displayed wrong. In the application, the same DW works fine. Inserted on the output of the called HTML generation method a text reset to the file, I look through it - everything is fine. If in the body of the ASP page itself there are Russian symbols, or something like document.Write ("Hello") then everything is displayed normally. The most interesting thing is if instead of COM I insert my object into Jaguar, then the encoding also changes, but in a different way. What could be the problem, and how to deal with it? Regarding the jaguar - he fundamentally does not understand Russian - so that he understands it is necessary to manually register the use in several configuration files Russian language and add Russian charsets and locales. And naturally then overload. And after each edit of the component in the jaguar restore Russian code page in the configuration file the corresponding component.
Question: Checking fields before closing the form in the ItemChange event, and I would like to just call this event at the end for each form field, but only calling this event requires in the parameters DWObject. And I was unable to find a means to get it along the way programs. Example from a running program: Window function passed as_objname and dwo is about the link, i.e. the same dwo is required. (This function used when it was necessary to trigger itemchanged events after how the button was pressed in dw and some script was executed, which in its queue of rules some fields for which the event should be processed itemchanged.) Maybe it turned out not as elegantly as we would like ;-)) / * of_GetDWObject (as_objname, dwo) Getting DWObject by DW Object Name Supports up to 59 objects in DW (Why more?) * / String ls_ret Int li_index, li_ret = 1 ls_ret = this.Describe (as_objname + '.ID') if ls_ret = '!' or ls_ret = '?' then li_ret = -1 else choose case Long (ls_ret) case 0 dwo = this.Object. # 0 case 1 dwo = this.Object. # 1 ... ... & etc. ... case 58 dwo = this.Object. # 58 case 59 dwo = this.Object. # 59 case else li_ret = -1 end choose end if return li_ret
Question: How to get the Computed field value There is some kind of subzh, let's say "compute_5". In it something is counted there, let's say a certain amount on a certain condition. How to get the value of the calculated expression in the given computed in the script fielde? Not an expression, but a ready-made figure. For example, [start script for example] decimal ld_some_var ld_some_var = dw_1.object.compute_5 [1] MessageBox ('', String (ld_some_var)) [end] Your amount will be in the boxing message. In general, read the help there is written about it. This script works if calculated field is in summary and footer DW fields if subtract field located in detail, then it's a little different there - I don't remember now ...
Question: How best to extend PFC And in what way did I add a layer, with pens or through the appropriate PFC utility Library Extender? The latter seems to me preferable, since a person is be wrong. Then not all objects in inheritance have the pfc_ * hierarchy pfe. * There are, for example, constructions pfc_ * => pfe. * => pfc_ * => pfe. * The layer was added with pens, because not in the loop about the utility. Where does she come from I installed 6.0 then patched to 6.5 and it seems like this utility appeared (although it may before the patch, I don’t remember how I didn’t have such problems) And if there is 5 Builder, then in the "full" last patch there is definitely (this I already for sure I don't remember - it was long ago). By complete, I mean that I did not take the patch from the Internet, and Moscow Sybase has a lot of everything, including the translation toolkit (to localize the application) ... in general, there is a whole trash heap, and not several files as in the internet. and what are the advantages? As I already wrote - the probability of error => 0 (unless, of course, the program is flawless) And what is not unimportant - this is done in a matter of minutes. Time is money if have money don't waste time ;-) The hierarchy of inheritance in my case, I think, does not really matter, because all objects of the application are inherited from pfe_, and I try to replace all layers libraries after full rebuild. And here it is, and moreover, it is huge! In short, use the utility - it is for you will explain a lot. Explain someone why it is not possible to create new functions, what significantly constrains PFC improvements and spoils the style ______________________ Pavel V. Vinogradov pavel@custody.ru
Question: Programming Style Let's do it like this BASIC_MASHIU_WIVERSAL_BELT (BMUP). Your task is define the behavior of this machine in the context of a particular object environment. To accomplish this task, we formulate a language that allows at the level of if-logic tell BMUP which components to get from and which variables to use. example: When working with the reference book, you can: 1) perform a search (perform a selection of a number of lines in accordance with k-l the criterion) 2) Add or remove lines to (from) the selection. 3) Perform modification of objects corresponding to each line of the selection We create a BMUP to perform these tasks - a window with DW-control and buttons [Search] [Add] [Delete] [Modify] BMUP is completely universal and abstract in relation to DW-object (with the exception of search attributes, but more on them later) The [Add] [Delete] buttons call up specific DW-controla interfaces The [Modify] button calls the window for editing the object corresponding current selection line. The edit window is formatted as a separate BMP The [Search] button performs a universal action: retrieve for dw - control according to search criteria It remains to describe from the outside: - the name of the dw-object that will be placed on the window - a list of search criteria (a way to get them from the current window or windows environment) - a link to the description of the object editor window. Everything!!! It remains to register the libraries through setlibrarylist and call BMUP to life search windows with reference to the created description. I made a similar library. I use it industrially. The effect is startling. Large projects contain no more than 5-6 windows created in PB (excluding objects basic abstractions). In the builder, almost one datawindow object is created. If interested - I can throw a description. Stas.V.Lipchansky@p14.f177.n465.z2.fidonet.org
Question: Constants for "special" colors are listed anywhere else background controls in dw? I do not know where they are, the most interesting. I took from this echo: ButtonFace: 79741120 Text: 33554432 Background: 1090519039 AppWorkSpace: 276856960 The rest of the primary colors can be found in the supplied with PB Watcom C. H \ graph.h Another answer: I determined these windows colors by setting objects with the color, exporting and then checking the values ​​(they do work). string cs_WinBack = "1090519039" string cs_ButtonFace = "79741120" string cs_WinText = "33554432" string cs_AppWkSpc = "276856960" I've been experimenting with this, starting with the suggestions from Daryl Anderson. I've found that the colors are represented in a LONG (4 byte word). The bottom three bytes are the RGB value. With a "normal" color, that's all that's used. For a System color, the top byte contains the code denoting the system color.I suspect, but can't prove, that these codes are different on different platforms. For Windows, the codes that I've found are (in hex notation): Button Face: 04 Window Text: 02 Window Background: 40 Application Work Space: 10 If we could use hex constants in PowerScript, it would be simple to specify the value of the "long" value to get a system color. Since we can't, we have to code the decimal value instead: ButtonFace = 0x04000000 = 67108864 WindowText = 0x02000000 = 33554432 WindowBackground = 0x40000000 = 1073741824 Application Work Space = 0x10000000 = 268435456 The reason that the different values you supply will also work is because they set the top byte of the word to the correct code. WHen that happens the bottom three bytes are ignored. (Probably, PB sees the code in the top byte, gets the proper color from the system, and stores that in the bottom three bytes). -- Tim Slattery Slattery_T@bls.gov
Question: 'Secret Bookmark' in PowerBuilder 7 :) To see her, do the following: 1. Launch PB7 2. Call Help / About 3. On the keyboard, type the word powersoft (good word ...) 4. We will be shown a rather humorous inscription ;-)))), and after it - a list of all those people who participated in the creation of PB. This 'feature' has been tested on 7.0.2 Build 8046. Roman V. Kabanov, rvk@i.am
Question: Highlighting the active dw line I use the following computerfield to indicate the active line color: if (getrow () = currentrow (), RGB (255,255,255), RGB (0,0,0)) background.color: if (getrow () = currentrow (), RGB (0,0,128), 2 ^ 26) with a similar script, I once fiddled with the problem of a different number of colors vidyahi on the client's machine - sometimes the text became downright unreadable .. And in all his DWs, he began to highlight the active line not with color, but with a border: border = "0 ~ tif (currentRow () = getrow (), 2, 0)" (this is from .srd;) and colors now play only the role of semantic highlighting of groups of columns (and always I try to look at this DW with a different color resolution setting)
Question: dw and Oracle stored procedures In short, with oraklovy procedures and DW there is some gimor. You need to use the ref cursor type, i.e. pointer to cursor by which you will return the result set you need to DW. The first parameter of your procedure will be a variable of type pointer to cursor. Well, in the procedure, you open this ref cursor and that's it. Next, dw will do fetch and close through the PB oci driver. For oracle 7.2 (you must specify the type returned by the cursor) create or replace package mycur as type rectype is record (dt date); type curtype is ref cursor return rectype; end mycur; / create or replace procedure mydwproc (dwresultset in out mycur.curtype) is begin open dwresultset for select to_date ('11 .11.1911 ',' DD.MM.YYYY ') from dual; end; / Well, for Oracle 7.3 and higher, it's generally simple (the first by the way will also work :-)) create or replace package mycur as type curtype is ref cursor; end mycur; / create or replace procedure mydwproc (dwresultset in out mycur.curtype) is begin open dwresultset for select to_date ('11 .11.1911 ',' DD.MM.YYYY ') from dual; end; / PS: you stick datawindow essno to mydwproc :-)