Page 1 of 2

xImage doubt

Posted: Sun Nov 17, 2024 5:48 pm
by wartiaga
Hi,

Eu tenho um campo memo em um dbf que armazenar uma imagem com o memoread()

oArqImg:IMAGEM := MemoRead(Alltrim(VetGars[x][10]))

Qual a melhor maneira de mostrar essa imagem posteriormente em uma dialog? Or other way to save and recover image with dbf/cdx.

I try:

@40,40 XIMAGE oImage SIZE 300,300 OF oDlg411 SOURCE MEMOREAD( Lista411:aRow[ 4 ] ) but I get this error:

Application
===========
Path and name: D:\SISTEMAS\ESC\finesc.exe (32 bits)
Size: 8,592,896 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20181011)
FiveWin version: FWH 18.11
C compiler version: Borland/Embarcadero C++ 7.3 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 8 secs
Error occurred at: 17/11/2024, 14:42:43
Error description: Error FiveWin/1 Non defined Id: No: 199

Stack Calls
===========
Called from: .\source\classes\CONTROL.PRG => TCONTROL:INITIATE( 452 )
Called from: .\source\classes\XIMAGE.PRG => TXIMAGE:INITIATE( 189 )
Called from: => __OBJSENDMSG( 0 )
Called from: => HB_EXECFROMARRAY( 0 )
Called from: .\source\function\HARBOUR.PRG => OSEND( 300 )
Called from: => HB_EXECFROMARRAY( 0 )
Called from: .\source\function\HARBOUR.PRG => ASEND( 278 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:INITIATE( 805 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 1120 )

Re: xImage doubt

Posted: Mon Nov 18, 2024 4:05 am
by nageswaragunupudi
Suggested way to link xbrowse and ximage:

Code: Select all | Expand

#include "fivewin.ch"

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oFont, oBrw, oImage

   if !File( "IMAGES.DBF" )
      CreateImagesDBF()
   endif

   USE IMAGES NEW SHARED VIA "DBFCDX"

   DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-16

   DEFINE DIALOG oDlg SIZE 800,400 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "XBROWSE + XIMAGE"
   @ 20,20 XBROWSE oBrw SIZE 380,-20 PIXEL OF oDlg ;
      DATASOURCE "IMAGES" ;
      COLUMNS "FOLDER", "NAME" ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :AutoFit()
      :nStretchCol := 1
      :bChange    := { || oImage:Refresh() }
      :CreateFromCode()
   END

   @ 20,400 XIMAGE oImage SIZE -20,-20 OF oDlg ;
      SOURCE ( oBrw:cAlias )->IMAGE

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

//----------------------------------------------------------------------------//

function CreateImagesDBF()

   DBCREATE( "IMAGES.DBF", { { "NAME", "C", 10, 0 }, ;
      { "FOLDER", "C", 40, 0 }, { "IMAGE", "M", 8, 0 } }, ;
      "DBFCDX", .T., "IMG" )

   AEval( ;
      { "..\bitmaps\olga1.jpg", "..\bitmaps\sea.bmp", ;
      "..\bitmaps\pngs\2.png", "..\bitmaps\007.bmp" }, <|c|
         DBAPPEND()
         FIELD->NAME    := UPPER( cFileName( c ) )
         FIELD->FOLDER  := cFilePath( c )
         FIELD->IMAGE   := MEMOREAD( c )
         return nil
         > )

   CLOSE IMG

return nil
Image

Re: xImage doubt

Posted: Mon Nov 18, 2024 5:15 am
by nageswaragunupudi
There is another simpler way to display images like above, without using XImage at all.
This is a sample.

Code: Select all | Expand

#include "fivewin.ch"

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oFont, oBrw, oImage

   if !File( "IMAGES.DBF" )
      CreateImagesDBF()
   endif

   USE IMAGES NEW SHARED VIA "DBFCDX"

   DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-16

   DEFINE DIALOG oDlg SIZE 800,500 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "XBROWSE WITHOUT XIMAGE"

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "IMAGES" ;
      COLUMNS "FOLDER", "NAME", "IMAGE" ;
      COLSIZES 200,150,400 ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :oRightCol   := "IMAGE"
      :oRightCol:lFullHeight := .t.
      :oRightCol:nDataBmpAlign := AL_CENTER
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

//----------------------------------------------------------------------------//

function CreateImagesDBF()

   DBCREATE( "IMAGES.DBF", { { "NAME", "C", 10, 0 }, ;
      { "FOLDER", "C", 40, 0 }, { "IMAGE", "M", 8, 0 } }, ;
      "DBFCDX", .T., "IMG" )

   AEval( ;
      { "..\bitmaps\olga1.jpg", "..\bitmaps\sea.bmp", ;
      "..\bitmaps\pngs\2.png", "..\bitmaps\007.bmp" }, <|c|
         DBAPPEND()
         FIELD->NAME    := UPPER( cFileName( c ) )
         FIELD->FOLDER  := cFilePath( c )
         FIELD->IMAGE   := MEMOREAD( c )
         return nil
         > )

   CLOSE IMG

return nil
Image

Re: xImage doubt

Posted: Mon Nov 18, 2024 1:13 pm
by wartiaga
nageswaragunupudi wrote:Suggested way to link xbrowse and ximage:

Code: Select all | Expand

#include "fivewin.ch"

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oFont, oBrw, oImage

   if !File( "IMAGES.DBF" )
      CreateImagesDBF()
   endif

   USE IMAGES NEW SHARED VIA "DBFCDX"

   DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-16

   DEFINE DIALOG oDlg SIZE 800,400 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "XBROWSE + XIMAGE"
   @ 20,20 XBROWSE oBrw SIZE 380,-20 PIXEL OF oDlg ;
      DATASOURCE "IMAGES" ;
      COLUMNS "FOLDER", "NAME" ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :AutoFit()
      :nStretchCol := 1
      :bChange    := { || oImage:Refresh() }
      :CreateFromCode()
   END

   @ 20,400 XIMAGE oImage SIZE -20,-20 OF oDlg ;
      SOURCE ( oBrw:cAlias )->IMAGE

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

//----------------------------------------------------------------------------//

function CreateImagesDBF()

   DBCREATE( "IMAGES.DBF", { { "NAME", "C", 10, 0 }, ;
      { "FOLDER", "C", 40, 0 }, { "IMAGE", "M", 8, 0 } }, ;
      "DBFCDX", .T., "IMG" )

   AEval( ;
      { "..\bitmaps\olga1.jpg", "..\bitmaps\sea.bmp", ;
      "..\bitmaps\pngs\2.png", "..\bitmaps\007.bmp" }, <|c|
         DBAPPEND()
         FIELD->NAME    := UPPER( cFileName( c ) )
         FIELD->FOLDER  := cFilePath( c )
         FIELD->IMAGE   := MEMOREAD( c )
         return nil
         > )

   CLOSE IMG

return nil
Image
Thank you so much Mr. Nages. I Use pelles c to create my dialogs and controls, how I can create a tximage control? Tximage works with redefine?

Re: xImage doubt

Posted: Mon Nov 18, 2024 2:05 pm
by karinha

Code: Select all | Expand

// C:\FWH\SAMPLES\XIMAGE08.PRG/RC

#include "fivewin.ch"

function Main()

   local oDlg, oImage, oSay
   local cPath   := "c:\\fwh1905\\bitmaps\\pngs\\"
   local aImages := DIRECTORY( cPath + "*.png" )
   local nImage  := 1

   AEval( aImages, { |a,i| aImages[ i ] := cPath + a[ 1 ] } )

   DEFINE DIALOG oDlg RESOURCE "diaporama" ;
      TITLE "Album de Fotos" COLOR CLR_BLACK, CLR_WHITE TRANSPARENT

   oDlg:lHelpIcon := .F.

   REDEFINE XIMAGE oImage SOURCE aImages[ nImage ] ID 101 OF oDlg UPDATE

   oImage:nUserControl := 0
   //   oImage:FitRect()

   REDEFINE SAY oSay PROMPT { || cFileName( aImages[ nImage ] ) } ID 102 ;
      OF oDlg UPDATE COLOR CLR_BLACK, CLR_WHITE

   REDEFINE BUTTON ID 503 OF oDlg WHEN nImage < Len( aImages ) ;
      ACTION ( nImage++, oDlg:Update() )

   REDEFINE BUTTON ID 504 OF oDlg WHEN nImage > 1 ;
      ACTION ( nImage--, oDlg:Update() )


   REDEFINE BUTTON ID 501 OF oDlg ACTION oDlg:End()

   oDlg:bPainted := { || oDlg:Box( oSay:nTop-1, oSay:nLeft-1, oSay:nTop + ;
                         oSay:nHeight, oSay:nLeft + oSay:nWidth, CLR_GRAY ) }

   ACTIVATE DIALOG oDlg CENTER

return nil

/*
DIAPORAMA DIALOG 22, 26, 311, 205
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Pedigree BullFight Photos"
FONT 12, "MS Sans Serif"
{
    PUSHBUTTON  "Close", 501, 246,  84, 45, 15
    PUSHBUTTON  "->", 503, 269, 53, 16, 17
    PUSHBUTTON  "<-", 504, 247, 53, 16, 17
    CTEXT  ""  102, 10, 172, 225, 13, SS_CENTERIMAGE
    CONTROL     "", 101, "TXImage", 0 | WS_CHILD | WS_VISIBLE, 10, 14, 225, 150
}

*/

/*
REDEFINE BUTTON ID 504 OF oDlg WHEN nImage > 1 ACTION ( nImage--, oImage:REFRESH() )
       REDEFINE BUTTON ID 503 OF oDlg WHEN nImage < Len( aDirectorio ) ACTION ( nImage++, oImage:REFRESH() )
 
*/
 
Regards, saludos.

Re: xImage doubt

Posted: Mon Nov 18, 2024 2:59 pm
by Jimmy
hi,

why do i need to #define all Constant in *.RC

Code: Select all | Expand

#define DS_MODALFRAME 0x0080
#define WS_POPUP            2147483648
#define WS_VISIBLE          268435456
#define WS_CAPTION          12582912
#define WS_SYSMENU          524288
#define WS_CHILD            1073741824
#define SS_CENTERIMAGE      0x00000200L

    DIAPORAMA DIALOG 22, 26, 311, 205
    STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    CAPTION "Pedigree BullFight Photos"
    FONT 12, "MS Sans Serif"
    {
        PUSHBUTTON  "Close", 501, 246,  84, 45, 15
        PUSHBUTTON  "->", 503, 269, 53, 16, 17
        PUSHBUTTON  "<-", 504, 247, 53, 16, 17
        CTEXT  ""  102, 10, 172, 225, 13, SS_CENTERIMAGE
        CONTROL     "", 101, "TXImage", 0 | WS_CHILD | WS_VISIBLE, 10, 14, 225, 150
    }
 
what do i miss for *.RC files :?:

Re: xImage doubt

Posted: Mon Nov 18, 2024 3:18 pm
by alerchster
in front of your rc-file

Code: Select all | Expand

#include "..\include\WinApi.ch"

Re: xImage doubt

Posted: Mon Nov 18, 2024 3:29 pm
by Jimmy
hi,
alerchster wrote:in front of your rc-file

Code: Select all | Expand

#include "..\include\WinApi.ch"
THX, that include i miss.

but still missing SS_CENTERIMAGE
XIMAGE.RC(11) : error RC2104 : undefined keyword or key name: SS_CENTERIMAGE
which i found in Winuser.H

Re: xImage doubt

Posted: Mon Nov 18, 2024 3:31 pm
by karinha
Jimmy wrote:hi,

why do i need to #define all Constant in *.RC

Code: Select all | Expand

#define DS_MODALFRAME 0x0080
#define WS_POPUP            2147483648
#define WS_VISIBLE          268435456
#define WS_CAPTION          12582912
#define WS_SYSMENU          524288
#define WS_CHILD            1073741824
#define SS_CENTERIMAGE      0x00000200L

    DIAPORAMA DIALOG 22, 26, 311, 205
    STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    CAPTION "Pedigree BullFight Photos"
    FONT 12, "MS Sans Serif"
    {
        PUSHBUTTON  "Close", 501, 246,  84, 45, 15
        PUSHBUTTON  "->", 503, 269, 53, 16, 17
        PUSHBUTTON  "<-", 504, 247, 53, 16, 17
        CTEXT  ""  102, 10, 172, 225, 13, SS_CENTERIMAGE
        CONTROL     "", 101, "TXImage", 0 | WS_CHILD | WS_VISIBLE, 10, 14, 225, 150
    }
 
what do i miss for *.RC files :?:
I don't understand Jimmy, what you're asking, is it in PELLESC.exe? In WORKSHOP.exe, you don't need this. WORKSHOP.exe is first line. The best RESOURCE EDITOR on the PLANET. hahahaha.

No entiendo Jimmy, lo que preguntas, ¿está en PELLESC.exe? En WORKSHOP.exe, no necesita esto. WORKSHOP.exe es la primera línea. El mejor EDITOR DE RECURSOS del PLANETA. jajajaja.

Regards, saludos.

Re: xImage doubt

Posted: Mon Nov 18, 2024 3:36 pm
by karinha
Origen, by master Nages:

https://forums.fivetechsoft.com/viewtopic.php?t=36135

Regards, saludos.

Re: xImage doubt

Posted: Tue Nov 19, 2024 5:43 am
by Jimmy
hi,
karinha wrote:I don't understand Jimmy, what you're asking, is it in PELLESC.exe? In WORKSHOP.exe, you don't need this. WORKSHOP.exe is first line. The best RESOURCE EDITOR on the PLANET.
NO i do NOT have a Resource Editor, I´m using only Fivewin.
But i Have never work with REDEFINE and *.RC before, so i have to learn it.

Re: xImage doubt

Posted: Tue Nov 19, 2024 12:14 pm
by karinha
Good morning Jimmy, without a doubt, WORKSHOP.exe from BORLAND is the simplest and easiest to use. Even though it is 16 bits, there is an emulator so you can run it in 64 bits. Look here: use Google translate.

https://fivewin.com.br/index.php?/topic ... ent-291687

https://github.com/otya128/winevdm/releases

Regards, saludos.

Re: xImage doubt

Posted: Wed Nov 20, 2024 10:04 am
by Jimmy
hi,
karinha wrote:WORKSHOP.exe from BORLAND is the simplest and easiest to use.
my Problem is that i don´t have WORKSHOP.EXE so i can´t use it.

Re: xImage doubt

Posted: Wed Nov 20, 2024 1:37 pm
by karinha
Jimmy wrote:hi,
karinha wrote:WORKSHOP.exe from BORLAND is the simplest and easiest to use.
my Problem is that i don´t have WORKSHOP.EXE so i can´t use it.
What do you mean you don't have WORKSHOP.exe? The best resource editor in the world?

¿Qué quieres decir con que no tienes WORKSHOP.exe? ¿El mejor editor de recursos del mundo?

Download WORKSHOP.exe 16 bits:

https://mega.nz/file/4dVF3ALB#OBUkXoLwM ... WCM2ksEbZM

Download WORKSHOP.exe 32 bits:

https://mega.nz/file/hEtlnQoZ#lUKQlfgyM ... SWOCaql74U

Gracias, tks.

Regards, saludos.

Re: xImage doubt

Posted: Thu Nov 21, 2024 10:35 am
by Jimmy
hi,
thx for the link to download WORKSHOP32.RAR :D

i have look inside and have read README.TXT and INSTALL.TXT but confused what to do.

as it are Files for Borland C++ 5.02 i do not understand how to handle it.
it seems Workshop Resource Editor is include in IDE so how to start IDE ?

i have read about Registry Setting for Borland C++ 5.02.
do i need to change them and SET them for BCC 7 ?

sorry for those Dummy Question, but i never have work this Way before :roll: