Problem with Ximage RESOLVED

Problem with Ximage RESOLVED

Postby Silvio.Falconi » Mon Nov 29, 2021 1:05 pm

Image

I have a small image and below a get with the name of the image but the get is readonly, and two buttons at side
when I delete the image with second button the border of the image must also include the underlying get,
when I load from first button an image I restore the initial dimensions
the problem is that it doesn't refresh below the oldest border

testsample
Code: Select all  Expand view  RUN
#include "fivewin.ch"


Function test()
local oDlg,oFont,oBold

local aGet[10]
local oBtnSel[20]
local oImage
  local cImgPath :=".\bitmaps\"
  local cImmagine      := cImgPath+UrlImage(ltrim("
accessori.jpg"))
  local cDefaImage:=cImgPath+UrlImage("
noImage.png")

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14
   DEFINE FONT oBold NAME 'Tahoma' SIZE 0, -14  BOLD

   DEFINE DIALOG oDlg SIZE  820,600   PIXEL TRUEPIXEL ;
   COLOR CLR_BLACK,  nRgb( 245,244,234)  FONT oFont  ;
   TITLE "
test"


    @ 30, 630 XIMAGE oImage ;
             FILENAME IF(empty(cImmagine),cDefaImage,cImmagine  );//  NOBORDER ;
             SIZE 150,90 ;
             OF oDlg ;
             UPDATE
    oImage:bRClicked  := { || NIL }
    oImage:ltransparent:=.t.
    oImage:nUserControl :=0




     @ 122, 630 GET aGet[2] VAR cImmagine SIZE 152,24 PIXEL OF oDlg READONLY

     @ 30, 784 BTNBMP oBtnSel[2] FLAT  SIZE 30, 24  OF oDlg PIXEL ;
                COLOR  nRgb(238,236,219),nRgb(238,236,219) ;
                BITMAP "
REP_CARICA" NOROUND;
                ACTION  (    oImage:setsize(155,90),oImage:refresh(),;
                cImmagine:= GetImage(),oImage:SetSource( cImmagine ),;
                           aGet[2]:shoW(),;
                          aGet[2]:ctext:=UrlImage(cImmagine),  aGet[2]:refresh())

      @ 60, 784 BTNBMP oBtnSel[3] FLAT SIZE SIZE 30, 24 OF oDlg PIXEL ;
            COLOR  nRgb(238,236,219),nRgb(238,236,219) ;
            RESOURCE "
REP_SVUOTA" ;
            TOOLTIP "
Svuota" ;
            ACTION ( oImage:setsize(155,110),oImage:refresh(),;
                      cImmagine:=cDefaImage,oImage:SetSource( cImmagine ),;
                       aGet[2]:Hide(),;
                      aGet[2]:ctext:="
",  aGet[2]:refresh() )




ACTIVATE DIALOG oDlg CENTERED


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

static Function UrlImage(curlImg)
   Local aTmp
   local nLevel := 1
   local x
   local cCad   :="
"
   aTmp := Hb_ATokens( curlImg, "
\" )
   For x = Len( aTmp ) - nLevel + 1 To Len( aTmp )
       cCad += AllTrim( aTmp[ x ] )
       if x < Len( aTmp )
          cCad  += "
\"
       endif
   Next x
  return cCad
//------------------------------------------------------------------------//
 static  function GetImage()

   local gcFile := cGetFile("
PNG   (*.png)| *.png|"  +         ;
                             "
Bitmap (*.bmp)| *.bmp|" +         ;
                             "
JPEG  (*.jpg)| *.jpg|" +          ;
                             "
GIF   (*.gif)| *.gif|"  +         ;
                             "
All Files (*.*)| *.*"             ;
                            ,"
Per favore seleziona un file immagine", 4 )

 *  if ! Empty( gcFile ) .and. File( gcFile )
 *     oImage:LoadBmp( gcFile )
 *  endif

 return gcFil



any solution ?
Last edited by Silvio.Falconi on Tue Nov 30, 2021 8:29 am, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with Ximage

Postby Silvio.Falconi » Tue Nov 30, 2021 8:29 am

Perhaps resolved

with Hide()/show()

Code: Select all  Expand view  RUN

#include "fivewin.ch"


Function test()
local oDlg,oFont,oBold

local aGet[10]
local oBtnSel[20]
local oImage
  local cImgPath :=".\bitmaps\"
  local cImmagine      := cImgPath+UrlImage(ltrim("
accessori.jpg"))
  local cDefaImage:=cImgPath+UrlImage("
noImage.png")

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14
   DEFINE FONT oBold NAME 'Tahoma' SIZE 0, -14  BOLD

   DEFINE DIALOG oDlg SIZE  820,600   PIXEL TRUEPIXEL ;
   COLOR CLR_BLACK,  nRgb( 245,244,234)  FONT oFont  ;
   TITLE "
test"


    @ 30, 630 XIMAGE oImage ;
             FILENAME IF(empty(cImmagine),cDefaImage,cImmagine  );// NOBORDER ;
             SIZE 150,90 ;
             OF oDlg ;
             UPDATE
    oImage:bRClicked  := { || NIL }
    oImage:ltransparent:=.t.
    oImage:nUserControl :=0




     @ 122, 630 GET aGet[2] VAR cImmagine SIZE 152,24 PIXEL OF oDlg READONLY

     @ 30, 784 BTNBMP oBtnSel[2] FLAT  SIZE 30, 24  OF oDlg PIXEL ;
                COLOR  nRgb(238,236,219),nRgb(238,236,219) ;
                BITMAP "
REP_CARICA" NOROUND;
                ACTION  ( oImage:Hide(),  cImmagine:= GetImage(),oImage:SetSource( cImmagine ),;
                            oImage:setsize(155,90),oImage:refresh(),;
                           aGet[2]:shoW(),oImage:show(),;
                          aGet[2]:ctext:=UrlImage(cImmagine),  aGet[2]:refresh())

      @ 60, 784 BTNBMP oBtnSel[3] FLAT SIZE SIZE 30, 24 OF oDlg PIXEL ;
            COLOR  nRgb(238,236,219),nRgb(238,236,219) ;
            RESOURCE "
REP_SVUOTA" ;
            TOOLTIP "
Svuota" ;
            ACTION ( oImage:Hide(),cImmagine:=cDefaImage,oImage:SetSource( cImmagine ),;
                     oImage:setsize(155,118),oImage:refresh(),oImage:show(),;
                       aGet[2]:Hide(),;
                      aGet[2]:ctext:="
",  aGet[2]:refresh() )




ACTIVATE DIALOG oDlg CENTERED


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

static Function UrlImage(curlImg)
   Local aTmp
   local nLevel := 1
   local x
   local cCad   :="
"
   aTmp := Hb_ATokens( curlImg, "
\" )
   For x = Len( aTmp ) - nLevel + 1 To Len( aTmp )
       cCad += AllTrim( aTmp[ x ] )
       if x < Len( aTmp )
          cCad  += "
\"
       endif
   Next x
  return cCad
//------------------------------------------------------------------------//
 static  function GetImage()

   local gcFile := cGetFile("
PNG   (*.png)| *.png|"  +         ;
                             "
Bitmap (*.bmp)| *.bmp|" +         ;
                             "
JPEG  (*.jpg)| *.jpg|" +          ;
                             "
GIF   (*.gif)| *.gif|"  +         ;
                             "
All Files (*.*)| *.*"             ;
                            ,"
Per favore seleziona un file immagine", 4 )

 *  if ! Empty( gcFile ) .and. File( gcFile )
 *     oImage:LoadBmp( gcFile )
 *  endif

 return gcFil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 78 guests