Quantcast
Channel: SCN : All Content - PowerBuilder Developer Center
Viewing all 2935 articles
Browse latest View live

Convert Richtext to upper case before saving datawindow.

$
0
0

Hi,

 

1. I need to convert all rich text data from lower case to upper case. how i can do it please guide me about RichText in datawindows.
2. Also, can i create my own Edit button and toolbar to set/format text style? if yes, example would be helpful.

 

Thanks,
Ram


Popup Menu for RichText in datawindow

$
0
0

Hi,

Currently i am unable to use the right click to choose default pop up menu(copy/paste option) for rich text control used in datawindow in PB 12.5.
I have tried below syntax, to open pop up menu:

 

dw_1.Object.DataWindow.RichText.PopMenu = "yes"

 

but this is not working and throwing error as :

---------------------------

PowerBuilder application execution error (R0039)

---------------------------

Application terminated.

 

Error: Error accessing external object property popmenu

(Line 1  Column 33: incorrect syntax.)

at line 7 in open event of object w_main.

---------------------------

OK  

---------------------------

 

could you please help me with this?

licence pb 11.5

$
0
0

Hi, please can someone tell me who to contact.

 

My pb11.5 licence has stopped working , my computer crashed , I had to repair windows, and now my pb11.5 is not licenced

 

Any info would be greatly appreciated.

 

Andrew

RegistryGet return -1 ?

$
0
0

Windows 7 64 bit Professional

PB 12.5

 

string las_val[]

 

li_ret = RegistryGet("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server", "InstalledInstances", RegMultiString!, las_val)

li_ret return  -1

 

but this key exists in registry

whats is wrong?

Row Group Level

$
0
0

Hi!

     How I get the group level of a row in a treeview datawindow on PB 12?

Thanks in advance

Why PB application run slower in Windows 7 than XP?

$
0
0

Hi there,

 

Why PB application in windows 7 64-bit slower than in XP? Is something that I need to change in OS level or PB?

The PB version 12.x

Any suggestion will be appreciated.

 

thx!

How to use .Net visual controls in PowerBuilder Classic

$
0
0

Using non-visual .Net classes in PowerBuilder Classic is somewhat straightforward.  Provided the assembly (and the classes and methods within it) have been marked as COM Visible, you can run REGASM on them to create OLE registry entries and then use the class through OLE Automation.  I have a video on the SAP D&T Academy that demonstrates the process.

 

Using Net visual controls takes a bit more work.  There is an add-in for Visual Studio Professional called the Microsoft InteropForms Toolkit that essentially puts an ActiveX wrapper around a .Net visual user object that can contain one or more visual controls.  Some observations:

 

  • The toolkit is an add-in for Visual Studio.  As a result, it will only work in the Professional or higher versions of Visual Studio.  The Express versions of VB6 Visual Studio don't support add ins.  Apparently some people have found a way around the limitation, but doing so is beyond the scope of this article.
  • The toolkit only supports the VB.net language.   If you are more comfortable with C#, there are third party utilities that extend the toolkit so that you can use C# instead.  That will not be covered in this article, but you can see Interop Forms Toolkit for C# - Home for one example.
  • The toolkit exposes Windows Forms controls.  However, you can add an ElementHost control to the toolkit control and then use that to host a WPF control.  Once again, that is beyond the scope of this article.

 

I have a video on the SAP D&T Academy as well that covers this technique.  This blog post will look at a different sample implementation than the one used in that video and will include the code used.

 

Note that the code used here was adapted from a CodeProject sample of a stand alone multi-page TIF viewer.  The code was converted from C# to VB.Net and then adapted to function as a single user object with methods rather that a stand alone viewer.

 

So, the first thing we're going to do is fire up Visual Studio.Net and create a new VB6 Interop UserControl.

 

newproject.PNG

Drag a PictureBox control over from the Toolbox onto the user object in the designer and then set the Dock property of the control to Fill.  Since we've only got one control in this user object, this will ensure that the PictureBox will always fill the entire contents of the user control when it's resized.

 

usercontrol.PNG

In the code editor, we're now going to declare some instance variables in the user object that we will use to track a few properties we're interested in the

"VB6 Interop Code" Region, just after the "#If COM_INTEROP_ENABLED Then" declaration.

 

 

    Private _CurrPage As Integer = 0 'defining the current page (its some sort of a counter)    Private _Opened As Boolean = False 'if an image was opened    Private _NumPages As Integer 'the number of pages in the tiff file    Private _FileName As String 'the name of the file that was opened

We want a couple of those to be read only properties as well for the control, so we add those into the "VB6 Properties" Region:

 

    Public ReadOnly Property NumberOfPages() As Integer        Get            Return _NumPages + 1        End Get    End Property    Public ReadOnly Property CurrentPageNumber() As Integer        Get            Return _CurrPage + 1        End Get    End Property

The reason that we're adding 1 to each of these values before returning it is because the mechanism that tracks the page numbers internal to the control is zero index based (the first page is page 0).  We need to adjust that before displaying it to the user who understands page numbers as one index based.

 

Finally, we're going to add some methods into the "VB6 Methods" Region, one of which is internal and the others which we'll be using from PowerBuilder to interact with the control.

 

The first method is the internal method that is used to refresh the image in the control when a TIF is first loaded or the user navigates to a different page:

 

    Private Sub RefreshImage()        Dim myBmp As Image 'a new occurrence of Image for viewing        Dim myImg As Image 'setting the selected tiff        myImg = System.Drawing.Image.FromFile(_FileName) 'setting the image from a file        _NumPages = myImg.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page) - 1 'the first page is 0 so we must correct the number of pages to -1        myImg.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, _CurrPage) 'going to the selected page        myBmp = New Bitmap(myImg, PictureBox1.Width, PictureBox1.Height) 'setting the new page as an image        'Description on Bitmap(SOURCE, X,Y)        PictureBox1.Image = myBmp 'showing the page in the pictureBox1    End Sub

Recreating myImg an _NumPages each time the function is called is perhaps a bit of overkill, but I wasn't interesting in trying to refactor the code, just convert it for this sample.

 

The following function is used to pass a filename from PowerBuilder into the control so that the control will read it and display the first page:

 

    Public Sub OpenFile(ByVal FileName As String)        _FileName = FileName        _CurrPage = 0 'reseting the counter        RefreshImage() 'refreshing and showing the new file        _Opened = True 'a file was opened.    End Sub

This function is used to navigate forward one page in the TIF file:

 

    Public Sub NextPage()        If (_Opened) Then 'the button works if the file is opened. you could go with button.enabled            If (_CurrPage = _NumPages) Then 'if you have reached the last page it ends here                'the "-1" should be there for normalizing the number of pages                _CurrPage = _NumPages            Else                _CurrPage = _CurrPage + 1                RefreshImage()            End If        End If    End Sub

And finally, this function is used to navigate back one page in the TIF file:

 

    Public Sub PriorPage()        If (_opened) Then 'the button works if the file is opened. you could go with button.enabled            If (_CurrPage = 0) Then 'it stops here if you reached the bottom, the first page of the tiff                _CurrPage = 0            Else                _CurrPage = _CurrPage - 1 'if its not the first page, then go to the previous page                RefreshImage() 'refresh the image on the selected page            End If        End If    End Sub

That's a good start.  The user object could obviously be embellished.  For example, offering methods to navigate to a certain page directly, zoom in and out on the displayed image, print one or more pages of the image, etc. could all be added later.

 

Once you compile the project, Visual Studio.Net will create the registry entries that make the user object available as an ActiveX control.  Open up PowerBuilder Classic, open a window control and start to insert an OLE Control onto the window.  In the dialog that appears, select the third tab (Insert Control), and then scroll to the name of the control you created in Visual Studio.net.  In my sample, I give it the rather unimaginative name of "TiffViewerControl.TiffViewerControl"

 

insertOLEControl.PNG

 

In the PowerBuilder window, I added buttons to open a TIF file and display it in the control, to move forward one page and to move backwards one page.  I also have a static text field that display the current page number and number of pages in the document.

 

Note that the functions and properties of the user object do not display in the PowerBuilder IDE.  You end up calling them as methods and properties of the ole control object attribute.  PowerBuilder compiles that without question and only attempts to validate that the references are valid when the code is run.

 

The script in the button that opens a TIF file for display is as follows:

 

Integer li_rc
String ls_pathname, ls_filename
li_rc = GetFileOpenName ( "Select a TIFF file", ls_pathname, ls_filename, "TIF", "TIF Files (*.tif),*.tif" )
IF li_rc = 1 THEN  ole_1.Object.OpenFile ( ls_pathname )  of_displaylocation()
END IF

To move forward one page:

 

ole_1.Object.NextPage()
of_displaylocation()

To move backwards one page:

 

ole_1.Object.PriorPage()
of_displaylocation()

The of_displaylocation function called by all three scripts is the one that populates the static text field with the current and total page numbers:

 

integer  li_currpage
integer  li_numpages
li_currpage = ole_1.Object.CurrentPageNumber
li_numpages = ole_1.Object.NumberOfPages
st_location.text = "Page " + String ( li_currpage ) + " of " + String ( li_numpages )

Finally, I have some code in the resize event of the window so that the user object resizes when the window is resized.

 

ole_1.Resize ( newwidth - 150, newheight - 250 )

With that, we're done.  Run the app, load up a TIF file and start browsing through it.  For this sample, I converted the 142 page PowerBuilder ORCA manual from PDF to TIF.

 

tifviewer.PNG

 

The sample code, both for Visual Studio.Net and for PowerBuilder 12.5 Classic, is available on my Google Drive.

Free Powerbuilder GIT MSSCCI provider


Cannot Install PB Runtime 12.0 or 12.5 on Windows 8 Server 2008 R2

$
0
0

Greetings All!!

 

I am trying to set up a new server for deployment and when I run either the PB Runtime for 12.0 or 12.5 I get an error stating (in general) module pbjvm120.dll failed to register.

 

I am also having this problem with another Windows 2008 Server install. I had to move on with the last one, but I need this one up and running now so I am asking for advice/help.

 

I attached a screenshot of the error.

 

Thanks all!!

 

Best,

 

Paul

Remove disabled look from multilineedit.

$
0
0

Hello!

 

I've got some dynamic layout work to do in PB Classic. I've got some layouts which requires n amounts of checkboxes to be created. Problem is that some of these checkboxes has large amounts of texts, or at least a couple of lines.

 

Since checkboxes can't have more than 1 line (as far as i can see). I need to come up with a solution that works for all cases, meaning an undefined amount of text for each checkbox which it only knows in runtime. So instead I use a MLE which I draw on top of the checkbox text. This leaves the checkbox button to be seen but with the MLE - text next to it which allows multiple lines.

 

The only problem is that the MLE has different behaviours than a regular checkbox text. For example you cannot highlight a checkbox text but you can of course hightext text in an MLE. If I put enabled = false then you cannot highlight anymore but the entire MLE gets a greyed out "disabled" look both for text and background. My question is basically, is there anything I can do about the disabled look? I want it to look like it's enabled.

Datawindow BUG in Powerbuilder .NET (12.5.1 4953)

$
0
0

Hi ,

I have created a wcf service in Powerbuilder .NET (12.5.1 build 4953).

If I want to modify a datawindow , for example add a column or modify the datatype Powerbuilder .NET crashes.

In other words I cannot modify an existing Datawindow. Only create a new one.

 

Will Sybase release a fix for this Huge BUG ?

 

thank you

PB 12 classic - consume RESTFUL service

$
0
0

Any one have example to consume RESTFUL service from PowerBuilder 12 Classic applications?

 

Thanks,
Senthil

how to navigate to function/event/object quickly?

$
0
0

I am using PB11.5. When check scripts, there many function/event call. I want to navigate the function quickly. For example,

 

uo.myfunction()  // the uo maybe in another pbl.

 

open(w_1)   // then I want to open w_1 by dbclick or right click, no need to find out w_1 in Object Browser, then open it

 

Is it possible to open script for myfunction() with double click or right click like Visual Studio or Eclipse?

how to setup printer for datawindow?

$
0
0

Suppose I have 2 datawindw: dw_1, dw_2

And there are more than on printer available on my windows, say print1, print2

I want to print dw_1 with print1, and print dw_2 with print2 with one click on a button. Is it possible to implement it in button click event?

How to migrate PB web services and web applications from 2003 to 2008 MS Server

$
0
0

Greetings All,

 

I have a bunch of web applications that I have deployed to a Windows Server 2003 server. The server is not behaving well and I need to move all of the web applications and web services to a new Windows 2008 Server.

 

I am really guessing at this. Could it be that easy? Seems not. The first web application I tried did not work.

 

I don't really know IIS 7.0.

 

I am guessing that I have to convert the directories shown in IIS 7.0 to applications. I have done this before. And I was prompted to enter a user id and password for the application.  In the past, I used the Administrator user id and password. Now I know that was wrong. First, we changed the Administrator domain password and everything on the server stopped working until I screwed around for hours recreating the 'applications' for each web site and web service. So I don't want to to go through that again. Also, I don't think I should be using Admin rights for a web service.

 

Somehow, this all seems to get done magically and correctly when you deploy via PB.

 

Can someone kindly tell me please...

 

1) What is PB doing during the deploy to a web server on the domain? What is it doing to create web applications, permissions and what user id is it using?

 

2) How can I replicate that manually while I am manually migrating the web applications and web services to a new Windows 2008 Server?

 

Thanks everyone!!

 

Paul


Automatic scrolling inside DW

$
0
0

Hi all!

 

I am building a restaurant table layout designer part in  my application.

 

I am creating dynamically some ellipse objects inside the Detail of a datawindow which the users must be able to move wherever they want.

 

Since there are huge halls, I need to have scrolling inside the datawindow. I mean, when a user "catches" an ellipse object and drags it towards eg the bottom of the datawindow, the datawindow should scroll automatically downwards.


Until now, I thought that this was a default PB behaviour. It seems not?


I set the Detail height to 5000. I have checked the VScrollBar and Live Scroll. No automatic scroll.


What else should I check?


Thanx in advance!

Absolute position of a control

$
0
0

Hello community,

 

I need to find the absolute position (x,y) of a control (eg: column )

I'm able to get the parent datawindow position by using:

 

Function boolean GetWindowRect( ulong hWnd, REF st_rectangle lpRect ) Library "user32.dll"

lb_rc = invo_super_external_functions.GetWindowRect( Handle(i_parentdw), lst_rectangle )

 

But I'll get the coordinates of the datawindow , I was not able to get the column itself ...

 

The goal is to use the result in a dropdown replacement window which needs to be properly placed in any case (eg: datawindow with groups and summary sections)

 

btw, a nice to have feature is the ability to recognize a multimonitor environment ...

 

Thanks in advance,

Nuno Madeira

how to get all data in a section from profile file?

$
0
0

Suppose I have profile ini have a section like:

[Mysection]

k1 =v1

k2=v2

....

 

the key-value pair could be dynamically in this section. then I want to get all data in Mysection.  How can I get it in a loop for all in powerscript?

how to setup data for datawindow with customized data?

$
0
0

I created a dw with datasource as external file. then define a few columns for this dw UI.

Then I want to get data from a ini file and save data also to ini file with script. How to retrieve data from ini file for this dw(not all data in ini, only part of data )?

REST Client Proxy Question

$
0
0

Objective: To call REST service from PB12.5.2 Classic application.

 

Current implementation: Using MSXML and INET objects to call GET and POST methods.

 

Problem: This implementation works fine until we have bulk calls (like 100K calls to the service in a single session). Sometimes it errors out because the XML sent to the service is 0 bytes (as seen on Fiddler)

 

Better alternative: Can we create a new PB.NET PB assembly with a REST client proxy and call the proxy function from our PB classic application? Can we build DLL and reference it from our classic application?

 

Is there any working example of the same?

 

Bruce - I have seen your example in http://brucearmstrong.sys-con.com/node/2133766/mobile

 

You talk about calling the WCF service from the classic application, have you tried the REST service call? I have followed the same steps you have mentioned and hit a roadblock when it came to the REGASM command, not sure which DLL to register now that I have 3 different DLLs. I have explained the steps I have taken in this document - http://www.pbgeeks.com/wp-content/uploads/pbnet.docx

 

 

Thanks,

Praveen

Viewing all 2935 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>