Page 2 of 2
Re: bitmap changed from user
Posted: Thu Mar 10, 2011 9:15 am
by Silvio
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
Re: bitmap changed from user
Posted: Thu Mar 10, 2011 10:31 am
by ukoenig
Silvio,
that cannot work !
@ 2, 250 BITMAP aGet[20] RESOURCE oggettoBmp[val(trim(cBmp))] NOBORDER PIXEL;
OF oFldMat:aDialogs[1] SIZE 20,20 UPDATETo change a Bitmap from resource is easy :
a Sample for xBrowse ( shows Bitmaps with different Colors )

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
@ 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 )
Re: bitmap changed from user
Posted: Thu Mar 10, 2011 11:23 am
by Daniel Garcia-Gil
Silvio
you save the position here
Code: Select all | Expand
aControl[20]:cResname := ltrim(STR(AScan( aItems, Trim( HW->type ))))
after
WE told you... use LoadImage...
In the start you use...
Code: Select all | Expand
@ 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
@ 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
Re: bitmap changed from user
Posted: Thu Mar 10, 2011 11:30 am
by Silvio
OK thanks Now run ok
Thanks Daniel, Thanks James

Re: bitmap changed from user - RESOLVED !!!
Posted: Thu Mar 10, 2011 2:11 pm
by James Bott
Falconi,
Glad to hear you got it working.
Your interface is looking very nice!
Regards,
James
Re: bitmap changed from user - RESOLVED !!!
Posted: Thu Mar 10, 2011 7:34 pm
by Silvio
thanks it is a project for a hardware support at mine school ( i work there)