September 26, 2022, 06:45:27 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Update 12-07-2013

Started by LarryMc, December 07, 2013, 12:40:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

Attached is updated alpha release of the IWGrid library (v0.06).
Place the IWGrid.lib file in your IWBDev/libs folder.
Place the IWGrid.inc file in your IWBDev/includes folder
$include "IWGrid.inc" needs to be placed at the beginning of any file that uses the lib.

In this release:

Fixed- misalignment of text with certain flag combinations.
Modified @IWGNOSCALE and @IWGRATIO flag operation and how they interact with each other.
Added the following commands:

  • IWG_GetCellButtonSize
  • IWG_SetCellButtonSize
  • IWG_GetCellImageSize
  • IWG_SetCellImageSize
  • IWG_GetCellImageMissingText
  • IWG_SetCellImageMissingText

This release does not contain a demo program. 
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

Well, I wish someone else were getting these problems!

Compiling Resources...
No Errors

Compiling...
FulfilmentGrid.iwb

Linking...
IWBasic Linker v1.11 Copyright © 2011 Ionic Wind Software
Unresolved external IWG_Create
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_Create
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_SetDim
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_ShowHeader
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_ShowRowNumbers
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_AutoNumberHeader
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_AutoAddRow
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_SetHiLightRow
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_SetRowHeight
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_SetGridColor
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_SetFont
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_SetColWidth
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_SetRowAutoHeight
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_SetGridProt
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_EnableEditDialog
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_GetRows
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_GetCurrentRow
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_GetCurrentCol
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_GetCellDat
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_InitCellDat
Error: C:\Documents and Settings\All Users\Documents\IWBasic\projects\IWGrid\FulfilmentGrid.o - Unresolved extern IWG_SetCellColor
Error(s) in linking FulfilmentGrid.exe

I know I have got it right this time!

Brian

billhsln

I put .lib in the libs subdir, .inc into the include subdir.  Then cleaned up the program due to changes in subroutine names.  Then compiled and got:

Compiling...
IWGrid_Demo.iwb
No Errors

Linking...
IWBasic Linker v1.11 Copyright © 2011 Ionic Wind Software
Unresolved external IWG_Create
Error: C:\Documents and Settings\All Users\Documents\IWBasic\Samples\IWGrid\IWGrid_Demo.o - Unresolved extern IWG_Create
Error: C:\Documents and Settings\All Users\Documents\IWBasic\Samples\IWGrid\IWGrid_Demo.o - Unresolved extern IWG_SetDim
Error: C:\Documents and Settings\All Users\Documents\IWBasic\Samples\IWGrid\IWGrid_Demo.o - Unresolved extern IWG_SetRowHeight
Error: C:\Documents and Settings\All Users\Documents\IWBasic\Samples\IWGrid\IWGrid_Demo.o - Unresolved extern IWG_SetColWidth
Error: C:\Documents and Settings\All Users\Documents\IWBasic\Samples\IWGrid\IWGrid_Demo.o - Unresolved extern IWG_InitCellDat
Error: C:\Documents and Settings\All Users\Documents\IWBasic\Samples\IWGrid\IWGrid_Demo.o - Unresolved extern IWG_SetCellCombo
Error: C:\Documents and Settings\All Users\Documents\IWBasic\Samples\IWGrid\IWGrid_Demo.o - Unresolved extern IWG_SetCellButtonCB
Error: C:\Documents and Settings\All Users\Documents\IWBasic\Samples\IWGrid\IWGrid_Demo.o - Unresolved extern IWG_SetCellRoundDec
Error: C:\Documents and Settings\All Users\Documents\IWBasic\Samples\IWGrid\IWGrid_Demo.o - Unresolved extern IWG_SetCellNoSymbol
Error: C:\Documents and Settings\All Users\Documents\IWBasic\Samples\IWGrid\IWGrid_Demo.o - Unresolved extern IWG_SetSymbol
Error: C:\Documents and Settings\All Users\Documents\IWBasic\Samples\IWGrid\IWGrid_Demo.o - Unresolved extern IWG_SetGridProt
Error(s) in linking C:\Documents and Settings\All Users\Documents\IWBasic\Samples\IWGrid\IWGrid_Demo.exe

I don't have as many errors, but I am using an old version of the demo program, so maybe it does not use as many features as Brian's program????

Seems to not work on my machine.

Bill
When all else fails, get a bigger hammer.

LarryMc

 ::) ::) oops ::) ::)

This time it is me.
open the IWGrid.inc file
Uncomment the following line
'$USE "IWGrid.lib"

Sorry about that. :-[
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

OK now, thanks!

You'll have to explain how I can dispense with my IF statements to test if
the cell has an image or text, please

Brian

LarryMc

right now you have
IF LEN(packs)>0
IWG_InitCellDat(win,501,numLine,loop+1,packs,@IWGIMAGE,@IWG_RATIO)
ELSE
IWG_InitCellDat(win,501,numLine,loop+1,packsText,@IWGTXT,@IWG_CENTERALIGN)
IWG_SetCellColor(win,501,numLine,loop+1,0x0000ff,0xff0000)
ENDIF


change it to this
IWG_InitCellDat(win,501,numLine,loop+1,packs,@IWGIMAGE,@IWG_RATIO)
IWG_SetCellImageMissingText(win,501,numLine,loop+1, packsText)
'IWG_SetCellImgMissingColor(main,501,2, 6,0x000ff,0xff0000)


The IWG_SetCellImgMissingColor command is commented out because it will be in the next release.
It will make the colors work correctly.  The code is done; I just need to update the help file for the 4 new commands.
You'll probably have it sometime tomorrow(24 hours)
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Fixing the .inc file cleaned up the errors on my side also.
Bill
When all else fails, get a bigger hammer.

LarryMc

Quote from: billhsln on December 07, 2013, 01:00:36 PM
Fixing the .inc file cleaned up the errors on my side also.
Bill
good
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

Great - will give it a go tomorrow

Brian

Brian

Had a go with your new code, but I'm puzzled (doesn't take much!)

   IWG_InitCellDat(win,501,numLine,loop+1,packs,@IWGIMAGE,@IWG_RATIO)
   IWG_SetCellImageMissingText(win,501,numLine,loop+1,packsText)
'   IWG_SetCellImgMissingColor(win,501,numLine,loop+1,0x000ff,0xff0000)

When I have a missing image, the text doesn't get placed. Surely the first InitCellDat
is stating that the cell is for an image and specifies a ratio? Shouldn't the
SetCellImageMissingText have the @IWGTXT,@IWG_CENTERALIGN constants
in, or at least allow you to set whatever you need yourself?

Brian

LarryMc

Quote from: Brian Pugh on December 08, 2013, 11:15:03 AM
Had a go with your new code, but I'm puzzled (doesn't take much!)

   IWG_InitCellDat(win,501,numLine,loop+1,packs,@IWGIMAGE,@IWG_RATIO)
   IWG_SetCellImageMissingText(win,501,numLine,loop+1,packsText)
'   IWG_SetCellImgMissingColor(win,501,numLine,loop+1,0x000ff,0xff0000)

When I have a missing image, the text doesn't get placed. Surely the first InitCellDat
is stating that the cell is for an image and specifies a ratio? Shouldn't the
SetCellImageMissingText have the @IWGTXT,@IWG_CENTERALIGN constants
in, or at least allow you to set whatever you need yourself?

Brian
In the mdb file you sent me there were no entries in the fields for missing image text.
When I edited your mdb to add text to that field it displayed properly when the image was mssing

as to the question of cell type and any flags
Here's how it works internally.
The information for all cells is stored the same way regardless of cell type.(The only exception is for images and combo type cells because they need additional info; the same will be true when I add the @IWGMASK type cells.)

All the cell type is used for is to tell me how to draw the cell.

Which brings us to the heart of the grid.
Think in terms of trying to create your own basic listview control from scratch and then, on top of that, add all the extra features that the grid has.
That's what I'm doing.
Every time something changes anywhere for any reason I reconstruct the entire visual portion of the grid.
I have to keep track of which cells are currently visible.
I then call a drawing routine where I loop through all the visible cells.
That routine does some common drawing like the grid lines themselves .
Within the loop is basically a huge SELECT/ENDSELECT block based upon celltype
Within each CASE statement are other select/endselect blocks and lots of IF/ELSEIF/ENDIF blocks that control the actual API drawing commands that put the pixels on the screen.

So the cell type used in the IWG_InitCellDat command is really nothing more than a flag to tell me how to draw the cell.
In the Case statement for drawing an IWGIMAGE cell I have a big IF/ELSE/ENDIF block.
The IF portion is whether or not I was able to load the image.
If I was able to then I do what I need to do to draw the image based upon the @IWGNOSCALE and @IWGRATIO flags.
If I couldn't load the image then I look to see if IWG_SetCellImageMissingText has been used to set any text.
If it has then I draw the text instead of the image.
That should explain why thee is no need for  @IWGTXT when using IWG_SetCellImageMissingText .
And, I chose to hardcode the centering of the text when I draw it in this case there is no need for the @IWG_CENTERALIGN flag.
I made that decision because images are centered (if they don't fill the cell).

Just FYI, there is the same sort of big SELECT/ENDSELECT block in the routine that is called when you click on a cell(select) so I can determine how to process it.

Hope that helps to understand what is going on better "under the hood".
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

@Brian
These are screenshots showing what it looks like with the image missing and the same with it there
And also the record I modified in your database.

Note: Ignore cell background colors; I was working on that.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library