Jump to content


Afiag's Content

There have been 8 items by Afiag (Search limited from 20-April 23)


By content type

See this member's

Sort by                Order  

#14478 PNG into CustomDraw

Posted by Afiag on 19 August 2010 - 03:53 AM in NextDBGrid Component

Hi Boki,

I was using the following code before:

procedure TForm1.NextDBGrid1CustomDrawCell(Sender: TObject; ACol, ARow: Integer;
CellRect: TRect; CellState: TCellState);
var
ABitmap: TBitmap;
FileName: string;
begin
FileName := 'images\ficons\' + QueryRankings.FieldByName('Location').AsString + '.bmp';
ABitmap := TBitmap.Create;
ABitmap.LoadFromFile(FileName);
NextDBGrid1.Canvas.Draw(CellRect.Left, CellRect.Top + 5, ABitmap);
ABitmap.Free;
end;


This worked fine with *.bmp files ... however I find myself needing to use *.png images instead ... when I try to use this code (but ofcourse changing "+ '.bmp'; to "+ '.png';") I get a error "not a valid bitmap image"... how would I go about on getting it to load my png images ?

Thanks !



#14403 NxDBHTMLColumn

Posted by Afiag on 22 July 2010 - 03:00 AM in NextDBGrid Component

Hey Berg,

Currently I'm trying to add a payment column for each record in my grid using paypal. As I have no clue really how to do this, I for now tried this route:

1. Add a NxDBHTMLColumn to my DBGrid.
2. In my online SQL Database add a "text" field called "buy" and add the following html code in this field for a test row:
CODE
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="QEB7DG5EKFPBG">
<input type="image" src="btn_cart_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="pixel.gif" width="1" height="1">

3. Link the NxDBHTMLColumn's fieldname to the "Buy" field in the online SQL database.

But this results in the word "memo" being displayed in every row on my DBGrid. I'm probably way off on how I am trying to achieve my goal here.... which is adding a paypal add to cart button to every row on my DBGrid. Which of course should be clickable and execute the html code as listed above. Biggest problem seems to be the limitation on paypal's end that their checkout procedures only work using a button using html code. I guess it would have been easier if I could just add a standard delphi code button to my dbgrid and have that linked to paypal but that doesn't seem possible sad.gif it needs to use the html form code to generate the button that provides a valid link when clicked upon.


EDIT: It just occured to me, I *could* just add a "buy" image to every row in a imagecolumn that when clicked opens a sort of popupwindow that exists out of a TWebbrowser that "links" to a website that has something along the lines:

"
Are you sure you want to add "ItemX" to your cart ?
<paypal add to cart button here>
"

and then when the user clicks the "add to cart button" on the popup window it would run as html and add it to my paypal cart ..... this is however an extra step that while it should work, I'd like to avoid and have the button straight in my dbgrid to eliminate this step ..



#14398 OnRowAdded Event ?

Posted by Afiag on 21 July 2010 - 01:32 AM in NextDBGrid Component

Hi Berg

I'd like some code to run everytime a row gets added to my dbgrid. But I don't see a "onrowadd" event or something similar. I could use "ondrawcell" but that would run the code multiple times every time a row is added I guess .. which doesn't seem to efficient....



#14034 DBImage column

Posted by Afiag on 24 May 2010 - 08:35 PM in NextDBGrid Component

QUOTE (Boki (Berg) @ May 24 2010, 04:35 PM) <{POST_SNAPBACK}>
Hello Afiag,

Maybe using OnApplyCell event may help? Add there Value := '3';

I hope that this helps.

Best regards


Works,
thanks.



#14032 DBImage column

Posted by Afiag on 24 May 2010 - 01:07 AM in NextDBGrid Component

Hey Boki

Currently Im using a DBImageColumn to present a icon stored in a imagelist in in my column. Now this works however it requires me to connect the columns using the "fieldname" to a field in my database and then have "3" in every single record in my database for that field. 3 is the index of the picture in the imagelist and while this works perfectly fine, I think its a waste to have to have thousands of records all with a "3" in a field just to let the icon show up....

To that end isn't there a way to someehow just forget the fieldname and just put that 3 in designtime somewhere so it knows it has to put imagelist1 index image 3 in the column ? It's ALWAYS 3, its never gona be any other image smile.gif



#14001 Two NxDBGrid Questions

Posted by Afiag on 11 May 2010 - 01:01 AM in NextDBGrid Component

Question 1.
I searched the net of the usage LIMIT which seems a mysql sort of thing, tried using it in my adoquery without much success

Question 2.
I (unsucesfully) tried the following ondrawcell:
if ACol = 5 then
NextDBGrid1.Cells[ACol][ARow] = TBitmap.Create.LoadFromFile('images\ficons\24\' + Adoquery1.FieldByName('flag').AsString + '.png');

Im prolly going in the wrong direction...



#13998 Two NxDBGrid Questions

Posted by Afiag on 10 May 2010 - 10:18 PM in NextDBGrid Component

Hey Berg, I have two questions concerning NxDBGrid.

1. How can I let my Adoquery return all records but skipping the first 4 records. I thought using a Increment column and then somehow filter it only shows records with > 4 but as the increment field is just a column in the NXGrid I don't know how to work with it in a Adoquery.

2. I want flag icons (nationality) in one field in my grid. I have 245 flag icons. I added a picture column but noticed that can't load a picture from a file, only from a imagelist. Now I don't want to work with a image list with 245 images for a few reasons... I have a field called "country" in my table that has the exact flag filename as string for each record so in other words this:
mystring := 'images\flags\' + Adoquery1.FieldByName('country').AsString + '.png'
results in the exact path to the image that needs to be displayed for that record.



#13826 Nxdbcombobox

Posted by Afiag on 23 March 2010 - 01:33 AM in NextDBGrid Component

I want to use a NxDBCombobox in my DBGrid. The problem is, how can I specify for each record what the combobox options will be ? (Because they will be different for every record), they options may be hardcoded they won't ever change. Remember I don't have one "list" and that's it, every record in the grid will have different combobox options which may be hardcoded (or looked up somehow, like in a access database for example)