bitmap changed from user - RESOLVED !!!

Re: bitmap changed from user

Postby Silvio » Thu Mar 10, 2011 9:15 am

I made

on Hwselction

if lOK
aControl[2]:cText := alltrim(Hw->Inventario)
aControl[3]:cText := alltrim(Hw->type)+" "+" Marca: "+;
alltrim(Hw->Marca)+" "+" Modello: "+alltrim(Hw->Modello)



aControl[20]:cResname := ltrim(STR(AScan( aItems, Trim( HW->type ))))





endif




on Pripara.prg

@ 5, 133 BUTTON oBtnSel PROMPT "..." OF oFldMat:aDialogs[1] PIXEL SIZE 10, 9 ;
ACTION (HwSeleccion( cInventario, aGet, oDlg ),;
cbmp:=aGet[20]:cresname ,;
nmsgbox(cBmp),;
aGet[20]:Refresh())


@ 2, 250 BITMAP aGet[20] RESOURCE oggettoBmp[val(trim(cBmp))] NOBORDER PIXEL;
OF oFldMat:aDialogs[1] SIZE 20,20 UPDATE



Now I have a number , I can select the number of array oggettoBmp[val(trim(cBmp))] but it not refresh the bitmaps

any idea
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: bitmap changed from user

Postby ukoenig » Thu Mar 10, 2011 10:31 am

Silvio,

that cannot work !

@ 2, 250 BITMAP aGet[20] RESOURCE oggettoBmp[val(trim(cBmp))] NOBORDER PIXEL;
OF oFldMat:aDialogs[1] SIZE 20,20 UPDATE


To change a Bitmap from resource is easy :
a Sample for xBrowse ( shows Bitmaps with different Colors )

Image

oBrw:bLClicked := { | nRow, nCol | IIF( oLbx1:nArrayAt = 1, oBMP:SetBMP( "Black" ) , NIL ), ;
IIF( oLbx1:nArrayAt = 7, oBMP:SetBMP( "Red" ), NIL ) }

To display a Image from File, You have to add :

aGet[20]:bPainted := {|hDC| < Your drawing-function > }

Next You need only a Refresh like < aGet[20]:Refresh() > to show a new Image.

here is a Sample with File-selection :

Code: Select all  Expand view

@ 30, 300 IMAGE oBmp FILENAME NIL OF oDlg SIZE 80, 50 PIXEL NOBORDER
oBMP:bPainted := {|hDC| DRAW_BRUSH(oBMP, hDC, cImage)}

// ---------- IMAGE-BRUSH ------------

FUNCTION DRAW_BRUSH( oBitmap, hDC, cFile )
LOCAL oNewBrush
LOCAL aRect := GETCLIENTRECT( oBitmap:hWnd )

IF FILE ( cFile ) // Image adjusted
     DEFINE IMAGE oNewbrush FILENAME cFile
     PalBmpDraw( hDC, 0, 0, oNewbrush:hBitmap, , aRect[4], aRect[3] )
ELSE
     IF !EMPTY( cFile )
          MsgAlert( "File : " + CRLF + cFile + CRLF + "not found !!!", "Error" )
     ENDIF
ENDIF

RETURN( NIL )
 
Last edited by ukoenig on Thu Mar 10, 2011 11:48 am, edited 3 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: bitmap changed from user

Postby Daniel Garcia-Gil » Thu Mar 10, 2011 11:23 am

Silvio


you save the position here
Code: Select all  Expand view
aControl[20]:cResname :=   ltrim(STR(AScan( aItems, Trim( HW->type ))))


after

Code: Select all  Expand view
cbmp:=aGet[20]:cresname ,;


WE told you... use LoadImage...

In the start you use...
Code: Select all  Expand view

@ 2, 250 BITMAP aGet[20] RESOURCE oggettoBmp[val(ltrim(cBmp))] NOBORDER PIXEL;
              OF oFldMat:aDialogs[1] SIZE 20,20    UPDATE


use same code in Button Action...

Code: Select all  Expand view

              @ 5, 133 BUTTON oBtnSel PROMPT "..." OF oFldMat:aDialogs[1]  PIXEL SIZE  10,  9  ;
                                         ACTION (HwSeleccion( cInventario, aGet, oDlg ),;
                                                    cbmp:=aGet[20]:cresname ,;
                                                   aGet[20]:LoadImage( oggettoBmp[val(ltrim(cBmp))] ),;
                                                   aGet[20]:Refresh())
 


this is a not correct way... but you dont need change the Arrays
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: bitmap changed from user

Postby Silvio » Thu Mar 10, 2011 11:30 am

OK thanks Now run ok
Thanks Daniel, Thanks James

Image
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: bitmap changed from user - RESOLVED !!!

Postby James Bott » Thu Mar 10, 2011 2:11 pm

Falconi,

Glad to hear you got it working.

Your interface is looking very nice!

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: bitmap changed from user - RESOLVED !!!

Postby Silvio » Thu Mar 10, 2011 7:34 pm

thanks it is a project for a hardware support at mine school ( i work there)
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests