Page 1 of 1

ColorView

Posted: Sat Mar 26, 2011 7:31 am
by RDalzell
Roger,

When attempting to compile your colorview example, it is missing the bdmslib.ch, which I assume is from Bobby, if he or you could share it would certainly be appreciated.

Thanks,
Rick

Re: ColorView

Posted: Sat Mar 26, 2011 9:57 am
by rdonnay
Oops. Probably should have finished that sample.

I asked Bobby if I could include it in the eXpress++ samples, but I tried working on it today to unbundle it from his stuff and it's going to take awhile to figure it out.

Re: ColorView

Posted: Sun Mar 27, 2011 12:55 am
by Auge_Ohr
XbpColorDialog() is include in v1.9.355 SL1 "XppUi2.lib" but not documented
try this

Code: Select all

#include "XBP.CH"
#include "APPEVENT.CH"
#include "GRA.CH"

#pragma library("XppUi2")

PROCEDURE APPSYS
RETURN

PROCEDURE Main
LOCAL nEvent, oXbp, mp1, mp2
LOCAL oDlg
LOCAL oColor
LOCAL aColor
LOCAL nColor
LOCAL nRGB1 := NIL
LOCAL nRGB2 := NIL
LOCAL oPushButton
LOCAL aSize := {400,300}
LOCAL aRGB  := {0,255,255}

   oDlg           := XbpDialog():new( ,, {0,0}, aSize  )
   oDlg:title     := "Dialog Farben Auswahl"
   oDlg:tasklist  := .t.
   oDlg:create()
   CenterControl(oDlg)

   oPushButton := XbpPushButton():new(oDlg:drawingArea,,;
                                  {100,50},{aSize[1]-200,aSize[2]-130} )
   oPushButton:caption := "Farben Auswahl"
   oPushButton:create()
   oPushButton:activate:= {|| nRGB1 := oColor:DISPLAY() }

   oColor := XbpColorDialog():New(oDlg:drawingArea)
//
// if use "User-define" Mode
//
*  oColor:mode := XBPCDLG_MODE_ALLOWCOLOREDIT
   oColor:mode := XBPCDLG_MODE_EDITCOLORS
*  oColor:mode := XBPCDLG_MODE_NOCOLOREDIT

   oColor:showHelp     := .F.           // Help Button
   oColor:displayAll    := .T.             // hm ...
   oColor:noDither      := .T.            // hm ...
   oColor:title := "Farbe Auswahl"
   oColor:center := .T.                   // zentriere auf Parent
//
// per-define Color. works only with define 16 Color
//
   oColor:defaultColor  := GraMakeRGBColor(aRGB)
//
   oColor:Create()

   SetAppWindow(oDlg)
   SetAppFocus(oDlg)
   SetAppFocus(oPushButton)

   nEvent := xbe_None
   DO WHILE nEvent != xbeP_Close
      nEvent := AppEvent ( @mp1, @mp2, @oXbp )
      //
      // just a workaround ?
      //
      IF nRGB2 <> nRGB1
         IF NIL <> nRGB1   // man muss prüfen ob der Wert "Sinn" macht
            aColor := GraGetRGBIntensity(nRGB1)
            IF NIL <> aColor
               nColor := GraMakeRGBColor(aColor)
               IF NIL <> nColor

// Result nColor 
                  oDlg:drawingArea:setColorBG(nColor)
// save new Color and update Display
                  oColor:defaultColor  := nColor
                  nRGB2 := nRGB1

               ENDIF
            ENDIF
         ENDIF
      ENDIF
      oXbp:HandleEvent ( nEvent, mp1, mp2 )
      IF nEvent == xbeP_Quit
         QUIT   // AppQuit()
      ENDIF
   ENDDO
   oColor:Destroy()
   oDlg:Destroy()
RETURN