Page 1 of 1

Xbase parts like Browse as TOOLTIP

Posted: Fri Aug 05, 2016 4:42 am
by unixkd
Hi all,

How can I use Xbase parts like Browse as TOOLTIP

Thanks

Joe

Re: Xbase parts like Browse as TOOLTIP

Posted: Fri Aug 05, 2016 6:37 am
by rdonnay
Explain how you would like it to work.

Are you wanting to scroll thru the browse?
How do you want the browse to disappear?

Re: Xbase parts like Browse as TOOLTIP

Posted: Fri Aug 05, 2016 8:39 am
by unixkd
Thanks Roger,

I Have a Browse and would like to have something like:

@ 0,0 DCROWSE .........

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

DCBROWSECOL FIELD MAST->SurName WIDTH 15 HEADER "Employee Name";
DATATOOLTIP {||.t.} TIPBLOCK {|| _Summary()}
------

Return nil

Static Function _Summary()
LOCAL GetList[0], GetOptions, aDir := Directory("*.*")

@ 0, 0 DCBROWSE oBrowse DATA aDir SIZE 53,11 PRESENTATION DC_BrowPres()
DCSETPARENT oBrowse
DCBROWSECOL ELEMENT 1 HEADER 'Period' WIDTH 6
DCBROWSECOL ELEMENT 2 HEADER 'Gross Income' WIDTH 10
DCBROWSECOL ELEMENT 3 HEADER 'Gross Deduction' WIDTH 10
DCBROWSECOL ELEMENT 4 HEADER 'Net Pay' WIDTH 10
DCSETPARENT
DCGETOPTIONS NORESIZE

DCREAD GUI FIT TITLE 'Summary Sheet' OPTIONS GetOptions BUTTONS DCGUI_BUTTON_EXIT

Return nil
*

Something like this will be very helpful

Re: Xbase parts like Browse as TOOLTIP

Posted: Fri Aug 05, 2016 10:17 am
by rdonnay
You didn't answer my question.

There are several ways that this can be accomplished:

1. Run the code in the tipblock (creating a dialog window), capture the window to a bitmap object, close the window, return the bitmap object. This would work with the existing datatootip system.

2. Run the code in the tipblock (creating a dialog window), return the dialog object. This would require a design change to the tooltip system, probably hours of work because you have not specified how you want it to behave.

3. Use the xbeM_Enter callback of the XbpCellGroup object of the browse to invoke the code that creates the dialog window and displays it. This would also require a few hours of work because you have not specified how you want it to behave.

You would save me a lot of time if you would specify what behavior you are expecting. By behavior, I mean do you expect to be able to scroll through the browse that is displayed (dynamic) or just display it like a bitmap (static)? A Dynamic browse would create a dozen more questions. It would require a lot more code, such as an event handler. Would you expect it to time out the same as a regular tooltip or wait for you to close the window?

Re: Xbase parts like Browse as TOOLTIP

Posted: Fri Aug 05, 2016 11:03 am
by unixkd
Hi Roger

You opened my eyes to deep concept of TOOLTIP.

Option 1 will not work for me because the browse will not be scrollable, But I love the concept.

Option 2 will be what I am looking for but will not ask you to engage in it now unless you have the time, that will be a great addition to eXpress++

I always say that Xbase++ is a special programming language and I always wish to explore. Roger, you gave us that impetus to be adventurous. It remind me of your interview with Steffen some years back where he predicted that there will be only 2 language companies in the world - Alaska and Microsoft, what do you think now ?

Thanks.

Joe

Re: Xbase parts like Browse as TOOLTIP

Posted: Fri Aug 05, 2016 11:46 am
by rdonnay
Option 2 will be what I am looking for but will not ask you to engage in it now unless you have the time, that will be a great addition to eXpress++
If it needs to be scrollable, then I think that option 3 is the best solution for you because I can work something out as a sample program rather than change my code.

A dynamic window cannot be considered the same as a tooltip. The concept isn't the same. It's better to have a solution that can allow optional mouse events to invoke the window. I'll write a sample for you.

Re: Xbase parts like Browse as TOOLTIP

Posted: Fri Aug 05, 2016 11:50 am
by rdonnay
It remind me of your interview with Steffen some years back where he predicted that there will be only 2 language companies in the world - Alaska and Microsoft, what do you think now ?
Steffen has always had grandiose visions, just like the development team of Visual Objects. Fortunately for us, his visions produced a much better product than VO. Xbase++ will never become a mainstream language but I have hopes that our little niche will last a long time. There are other languages besides Microsoft. There is Java and other internet languages, but when it comes to desktop languages for business applications, I will take Xbase++ any time.

Re: Xbase parts like Browse as TOOLTIP

Posted: Sat Aug 06, 2016 1:51 am
by unixkd
Thanks Roger

I will be expecting your sample based on option 3

Joe

Re: Xbase parts like Browse as TOOLTIP

Posted: Sun Aug 07, 2016 10:36 am
by rdonnay
Here is a sample program in which the Right mouse button is used to popup a new browse window.
In this sample, an entire directory structure can be browsed.

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

BrowseDir( 'C:' )

RETURN nil

* ----------

FUNCTION BrowseDir( cStartDir )

LOCAL GetList[0], oBrowse, aDir, nPointer := 1, GetOptions

cStartDir += '\'
aDir := Directory( cStartDir + '*.*','D' )

@ 0,0 DCBROWSE oBrowse SIZE 60,20 FONT '10.Lucida Console' ;
      RBSELECT DATA aDir POINTER nPointer FIT ;
      COLOR {||IIF('D'$aDir[oBrowse:arrayElement,5],{nil,GRA_CLR_CYAN},nil)}

DCBROWSECOL ELEMENT 1 HEADER 'Directory / FileName' WIDTH 50 PARENT oBrowse ;
   EVAL {|o|o:dataArea:rbClick := ;
            {||IIF('D' $ aDir[nPointer,5],BrowseDir(cStartDir+aDir[nPointer,1]),nil)}}

DCBROWSECOL ELEMENT 5 HEADER 'Attr' WIDTH 4 PARENT oBrowse

DCGETOPTIONS RESIZE RESIZEDEFAULT DCGUI_RESIZE_RESIZEONLY HIDE

DCREAD GUI FIT TITLE 'Directory of ' + cStartDir MODAL SETAPPWINDOW ;
   OPTIONS GetOptions ;
   EVAL {|o|Cascade(o),o:show()}

RETURN nil

* ---------

PROC appsys ; RETURN

* ---------

STATIC FUNCTION Cascade( oDlg )

LOCAL nCol := 0, nRow, aCoords

nRow := oDlg:parent:currentSize()[2]
aCoords := DC_CascadeCoords(oDlg:parent,.f.,{nRow,nCol},.t.,oDlg)
nRow := aCoords[1] - oDlg:currentSize()[2]
nCol := aCoords[2]

IF Valtype(nCol) = 'N' .AND. Valtype(nRow) = 'N'
  oDlg:setPos( { nCol, nRow } )
ENDIF

RETURN nil