Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 5 Monaten
Letzter Beitrag:
vor 1 Jahr, 5 Monaten
Beteiligte Autoren:
Sivaprakash, Fabrice Harari, Gianni Spano

[WD20] Displaying image in a Table

Startbeitrag von Sivaprakash am 30.08.2016 10:26


I need to display (then save to file) an image, which is captured through a webcam. Capturing and displaying in an image control is working fine. After capturing, and entering other details, on click of a button, I transfer all those information to a table and blank out the entry form, for next entry.

Code in the button

iRow = TableAddLine(Table1)
Table1.Field1[iRow] = EDT_field1
Table1.Field2[iRow] = CMB_field2.DisplayedValue
Table1.Image[iRow] = IMG_photo

Here field1 and field2 values are assigned correctly for all rows. For image, if I add the second row, images in all rows changes to last assigned image. When I add the second row, first row image also updated with second row image. While adding the third row, all images becomes third row image.

Anything I'm missing, or doing wrong ?

Happiness Always
BKR Sivaprakash



Can I assign an image variable to a column in table ? If I assign, all values of that column changes to the new image. Is it a bug or there are other ways of assigning.

Happiness Always
BKR Sivaprakash

von Sivaprakash - am 01.09.2016 06:23

I think a possible solution is to declare the column as "Container" and put an image control, then handle it to show the correct image..

My 2 cents


von Gianni Spano - am 01.09.2016 13:30

as I was quite surprised by your description, I created a quick test project, with one window, one table filled by programming, and 3 columns in it, one being an image

I added a button to fill the table initially, then another button to select an image from disk

Once an image is selected, I display it in an image control outside the table (for control).

I then proceeded to do your "Table1.Image[iRow] = IMG_photo"
I did it 3 different ways:
1. by setting from the image control... it worked
2. by setting directly from the file name on disk... it worked
3. by declaring an image variable, putting the file from disk in it, then setting the colum from the image control... it worked

So my conclusion is that this continues to work the same way it always had, and that there is a problem in your REAL code (not the simplified one you are showing us)

Best regards

von Fabrice Harari - am 01.09.2016 13:37
Thanks Fabrice for your time. Here's my actual code

// Global declaration of w_TXPurchase
iRow is int

//After entry in free form, on click of a button
TBL_TXPurchaseDetail.COL_VarietyName[iRow] = CMB_VarietyName..DisplayedValue
//TBL_TXPurchaseDetail.COL_VarietyGUID[iRow] = gpoLookup.GetVarietyGUID(AnsiToUnicode(CMB_VarietyName..DisplayedValue))
TBL_TXPurchaseDetail.COL_BrandName[iRow] = CMB_BrandName..DisplayedValue
//TBL_TXPurchaseDetail.COL_BrandGUID[iRow] = gpoLookup.GetBrandGUID(AnsiToUnicode(CMB_BrandName..DisplayedValue))
TBL_TXPurchaseDetail.COL_ModelName[iRow] = CMB_ModelName..DisplayedValue
//TBL_TXPurchaseDetail.COL_ModelGUID[iRow] = gpoLookup.GetModelGUID(AnsiToUnicode(CMB_ModelName..DisplayedValue))
TBL_TXPurchaseDetail.COL_PatternName[iRow] = CMB_PatternName..DisplayedValue
//TBL_TXPurchaseDetail.COL_PatternGUID[iRow] = gpoLookup.GetPatternGUID(AnsiToUnicode(CMB_PatternName..DisplayedValue))
TBL_TXPurchaseDetail.COL_ShadeName[iRow] = CMB_ShadeName..DisplayedValue
//TBL_TXPurchaseDetail.COL_ShadeGUID[iRow] = gpoLookup.GetShadeGUID(AnsiToUnicode(CMB_ShadeName..DisplayedValue))
TBL_TXPurchaseDetail.COL_DesignNumber[iRow] = EDT_DesignNumber
TBL_TXPurchaseDetail.COL_FromSizeCode[iRow] = CMB_FromSize..DisplayedValue
//TBL_TXPurchaseDetail.COL_FromSizeGUID[irow] = gpoLookup.GetSizeGUID(AnsiToUnicode(CMB_FromSize..DisplayedValue))
TBL_TXPurchaseDetail.COL_ToSizeCode[iRow] = CMB_ToSize..DisplayedValue
TBL_TXPurchaseDetail.COL_UOMName[iRow] = CMB_UOM..DisplayedValue
TBL_TXPurchaseDetail.COL_TaxName[iRow] = CMB_TaxName..DisplayedValue
TBL_TXPurchaseDetail.COL_Rolls[iRow] = EDT_rolls
TBL_TXPurchaseDetail.COL_Quantity[iRow] = EDT_Quantity
TBL_TXPurchaseDetail.COL_Rate[iRow] = EDT_Rate
TBL_TXPurchaseDetail.COL_Amount[iRow] = EDT_Amount
TBL_TXPurchaseDetail.COL_RateDifferenceRate[iRow] = EDT_RateDiff
TBL_TXPurchaseDetail.COL_DiscountPercent[iRow] = EDT_Disc
TBL_TXPurchaseDetail.COL_DiscountAmount[iRow] = EDT_DiscountAmount
TBL_TXPurchaseDetail.COL_AfterDiscountAmount[iRow] = EDT_AfterDiscountAmount
TBL_TXPurchaseDetail.COL_SpecialDiscountPercent[iRow] = EDT_SplDisc
TBL_TXPurchaseDetail.COL_SpecialDiscountAmount[iRow] = EDT_SpecialDiscountAmount
TBL_TXPurchaseDetail.COL_AfterSpecialDiscountAmount[iRow] = EDT_SpecialDiscountAmount
TBL_TXPurchaseDetail.COL_AdditionalDiscountPercent[iRow] = EDT_AddlDisc
TBL_TXPurchaseDetail.COL_AdditionalDiscountAmount[iRow] = EDT_AdditionalDiscountAmount
TBL_TXPurchaseDetail.COL_AfterAdditionalDiscountAmount[iRow] = EDT_AfterAdditionalDiscountAmount
TBL_TXPurchaseDetail.COL_OtherDiscountAmount = EDT_OtherDiscAmt
TBL_TXPurchaseDetail.COL_AfterOtherDiscountAmount = EDT_AfterOtherDiscountAmount
TBL_TXPurchaseDetail.COL_BeforeTaxRate = EDT_BeforeTaxRate
TBL_TXPurchaseDetail.COL_BeforeTaxAmount = EDT_BeforeTaxAmount
TBL_TXPurchaseDetail.COL_TaxPercent[iRow] = EDT_Vat
TBL_TXPurchaseDetail.COL_TaxAmount[iRow] = EDT_TaxAmount
TBL_TXPurchaseDetail.COL_NetAmount[iRow] = EDT_NetAmount
TBL_TXPurchaseDetail.COL_NetRate[iRow] = EDT_NetRate

TBL_TXPurchaseDetail.COL_Photo[iRow] = IMG_Picture

// local procedure uf_clearrow(), clears all free form fields

IMG_Picture = ""
CMB_VarietyName = ""
CMB_BrandName = ""
CMB_ModelName = ""
CMB_PatternName = ""
CMB_ShadeName = ""
EDT_DesignNumber = ""
CMB_FromSize = ""
CMB_ToSize = ""
CMB_UOM = ""
CMB_TaxName = ""
CMB_LocationName = ""
EDT_rolls = ""
EDT_rolls..Grayed = True
EDT_Quantity = 0
EDT_Rate = 0
EDT_RateDiff = ""
EDT_Disc = 0
EDT_SplDisc = 0
EDT_AddlDisc = 0
EDT_OtherDiscAmt = 0
EDT_Vat = 0
EDT_Amount = 0
EDT_DiscountAmount = 0
EDT_AfterDiscountAmount = 0
EDT_SpecialDiscountAmount = 0
EDT_AfterSpecialDiscountAmount = 0
EDT_AdditionalDiscountAmount = 0
EDT_AfterAdditionalDiscountAmount = 0
EDT_OtherDiscAmt = 0
EDT_AfterOtherDiscountAmount = 0
EDT_BeforeTaxRate = 0
EDT_BeforeTaxAmount = 0
EDT_TaxAmount = 0
EDT_NetAmount = 0
EDT_NetRate = 0

STA_TotalNoofTbl = iRow
STA_SelectedRow = "New"
BTN_AddRow..Grayed = False

Here IMG_Picture is giving me the trouble.

It assigns the picture to the correct row. When I move the cursor to the table, or when I click some cell in the table, all displayed image changes to the last image that I assigned to the table.

Happiness Always
BKR Sivaprakash

I've to wait for a few seconds, after capturing the image and before clicking the add button. Otherwise only the previous captured image gets added to the table.

von Sivaprakash - am 02.09.2016 02:38

the first thing to do is to correct ALL the lines so that ALL the lines have the [iRow] part.
By example :
TBL_TXPurchaseDetail.COL_OtherDiscountAmount = EDT_OtherDiscAmt
TBL_TXPurchaseDetail.COL_AfterOtherDiscountAmount = EDT_AfterOtherDiscountAmount
TBL_TXPurchaseDetail.COL_BeforeTaxRate = EDT_BeforeTaxRate
TBL_TXPurchaseDetail.COL_BeforeTaxAmount = EDT_BeforeTaxAmount

(there may be others)

They do not DIRECTLY concern the image, but your problem may be a side effect.

Best regards

von Fabrice Harari - am 02.09.2016 11:14
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.