1. Using EUGrid in IDE

I'm sure the answer to this question, when revealed to me by the august
participants in this forum, will be so blindingly obvious that I will thwack
myself on the forehead with the palm of my hand, and utter in a soulful way
'Duh'!

Maybe it's just too late at night. But here goes:

I want to build a grid. I've done a little fooling around with the samples, and
made a grid like the one I want, outside IDE.

Now I want to add this grid to an existing IDE project. I open up the project,
and click 'grid', click again, and there it is. A grid exists. Now, just where in
the IDE environment do I enter the code that will give the grid the necessary
attributes? Code such as 'EGW-ADDColumn'?

If this was a button or field, I could trap user actions by using IDE to setup
actions for 'onClick', etc. How in IDE do I trap user actions such as
EGW_CELLCHANGE?

Thanks all,

-- 
Craig

new topic     » topic index » view message » categorize

2. Re: Using EUGrid in IDE

Craig Welch wrote:
> 
> 
> I'm sure the answer to this question, when revealed to me by the august
> participants
> in this forum, will be so blindingly obvious that I will thwack myself on the
> forehead
> with the palm of my hand, and utter in a soulful way 'Duh'!
> 
> Maybe it's just too late at night. But here goes:
> 
> I want to build a grid. I've done a little fooling around with the samples,
> and made
> a grid like the one I want, outside IDE.
> 
> Now I want to add this grid to an existing IDE project. I open up the project,
> and
> click 'grid', click again, and there it is. A grid exists. Now, just where in
> the IDE
> environment do I enter the code that will give the grid the necessary
> attributes? Code
> such as 'EGW-ADDColumn'?
> 
> If this was a button or field, I could trap user actions by using IDE to setup
> actions
> for 'onClick', etc. How in IDE do I trap user actions such as EGW_CELLCHANGE?
> 
> Thanks all,
> 
> -- 
> Craig
> 
Craig,

To add a column to the grid just select a control and drop it into the
(i.e. a static control).  This will add the necessary EGW_AddColumn to
the grid.

As far as EuGrid event handling is concerned, all events are sent to the
_onEvent routine for the grid control.  In the event you'll have to
disect the parameters to determine what the event was.  Here's an 
EuGrid event handling routine from one of my programs:

procedure ColMapEG_onEvent (integer self, integer event, sequence
params)--params is ( int iMsg, atom wParm, atom lParm )
    atom msg, wParam, lParam, row_count
    sequence check_libs, msgs
    object row_data

    -- Extract message and params
    msg = params[1]
    wParam = params[2]
    lParam = params[3]


    -- On cell change save the data for the cell being exited
    if msg = EGW_CELLCHANGE then
        void = EGW_SaveCellData(ColMapEG, EGW_GetCurrentCell(ColMapEG))
    -- When the row changes
    elsif msg = EGW_ROWCHANGE then
        row_data = EGW_GetDataRow(ColMapEG, wParam)
    	-- The user must select either a column name or type a default value
    	-- for each record
    	if not length(row_data[CSVColumn]) and not length(row_data[DftValue]) then
void = message_box("You must select either a column name or supply a
    default " &
    				"value for each column!", "Missing Column Data", MB_OK)
			-- Ensure the cell in error is displayed
			void = EGW_ScrollToCell(ColMapEG, wParam, CSVColumn)
			-- Set the focus to the library grid
			setFocus(ColMapEG)
			-- This instructs the grid control to not perform any more processing
			-- for this event
			returnValue(True)
			return
    	end if
    	-- The user must not select a column name and type a default value
    	-- for each record
    	if length(row_data[CSVColumn]) and length(row_data[DftValue]) then
void = message_box("You can only select either a column name or supply a
    default " &
    				"value for each column!", "Column Data Specified Twice", MB_OK)
			-- Ensure the cell in error is displayed
			void = EGW_ScrollToCell(ColMapEG, wParam, CSVColumn)
			-- Set the focus to the library grid
			setFocus(ColMapEG)
			-- This instructs the grid control to not perform any more processing
			-- for this event
			returnValue(True)
			return
    	end if
    	-- If the user specified a default value then ensure the data is consistent
    	-- with the column type
    	if length(row_data[DftValue]) then
    		if find(row_data[ColType],sql_numeric_types) then
    			rtn_obj = value(row_data[DftValue])
    			if rtn_obj[1] != GET_SUCCESS then
		    		void = message_box("Default value is invalid for column Type",
		    				"Invalid Default Value", MB_OK)
					-- Ensure the cell in error is displayed
					void = EGW_ScrollToCell(ColMapEG, wParam, DftValue)
					-- Set the focus to the library grid
					setFocus(ColMapEG)
					-- This instructs the grid control to not perform any more processing
					-- for this event
					returnValue(True)
					return	
    			end if
    		end if
    	end if
    end if

end procedure
setHandler( ColMapEG, w32HEvent, routine_id("ColMapEG_onEvent"))


Make sure you also take a look at the documentation that comes with 
EuGrid, it will explain this in more detail.

Jonas

new topic     » goto parent     » topic index » view message » categorize

3. Re: Using EUGrid in IDE

Jonas Temple wrote:

>Craig,
>
>To add a column to the grid just select a control and drop it into the
>(i.e. a static control).  This will add the necessary EGW_AddColumn to
>the grid.

Got it. That works fine, thanks.

Now, if I do that, I'm not able to format the columns in all of the 
various ways defined by EuGrid, am I? For example, if I attempt to use 
a multi-line edit control, IDE says: "Invalid control for EuGrid". Is 
there a way of creating such a control myself, somewhere in IDE's editor?

One of the key aspects of EuGrid is the separation of the underlying 
data and the data presented in the grid. That's why, when creating a 
grid column, one of the parameters is 'DataColumn'. In my project, for 
example, my data are arranged in 11 columns, but I only need to 
display 5 of them. In IDE, it seems that I must create a grid column 
for each dataset column. I've tried unchecking 'visible' on the 
un-needed columns, but they're still displayed.

As I type this, it occurs to me that I might just set the column width 
to zero for the un-needed columns. I'll try that shortly.

>As far as EuGrid event handling is concerned, all events are sent to the
>_onEvent routine for the grid control.  In the event you'll have to
>disect the parameters to determine what the event was.  Here's an 
>EuGrid event handling routine from one of my programs:
>  
>
Aha! I understand. And thanks for your example, which provides me with 
a good template.

>Make sure you also take a look at the documentation that comes with 
>EuGrid, it will explain this in more detail.
>
Heh, fair suggestion. But prior to posting, I had read every word. I'm 
fairly comfortable with how to use EuGrid's functions and messages. 
The two things I didn't understand were how to establish the functions 
and how to get access to the messages within the IDE environment. 
You've given me two 'Aha' explanations. Neither of which is mentioned 
in the EuGrid documentation.

Thanks,

-- 
Craig

new topic     » goto parent     » topic index » view message » categorize

4. Re: Using EUGrid in IDE

Craig Welch wrote:
> Now, if I do that, I'm not able to format the columns in all of the 
> various ways defined by EuGrid, am I? For example, if I attempt to use 
> a multi-line edit control, IDE says: "Invalid control for EuGrid". Is 
> there a way of creating such a control myself, somewhere in IDE's editor?
> 
> One of the key aspects of EuGrid is the separation of the underlying 
> data and the data presented in the grid. That's why, when creating a 
> grid column, one of the parameters is 'DataColumn'. In my project, for 
> example, my data are arranged in 11 columns, but I only need to 
> display 5 of them. In IDE, it seems that I must create a grid column 
> for each dataset column. I've tried unchecking 'visible' on the 
> un-needed columns, but they're still displayed.
> 
> As I type this, it occurs to me that I might just set the column width 
> to zero for the un-needed columns. I'll try that shortly.
> 
I think Judith is working on enhancements to the IDE to handle 
multi-line edit controls.  I think she also realizes that the IDE doesn't
quite handle all of the features of EuGrid. Judith, if I've spoken out of
turn feel free to correct me.

One suggestion...you could just use the IDE to place the grid control
in the window and then using the code editor go into the Into or General 
section and type the EGW_AddColumn calls yourself.  That way you'd be 
able to set the underlying column.

Jonas

new topic     » goto parent     » topic index » view message » categorize

5. Re: Using EUGrid in IDE

Jonas Temple wrote:

> One suggestion...you could just use the IDE to place the grid control
> in the window and then using the code editor go into the Into or General 
> section and type the EGW_AddColumn calls yourself.  That way you'd be 
> able to set the underlying column.

OK, I didn't realise I could put EuGrid controls there. I'll
experiment with that.

Thanks,

new topic     » goto parent     » topic index » view message » categorize

6. Re: Using EUGrid in IDE

Craig Welch wrote:

> Jonas Temple wrote:

>> One suggestion...you could just use the IDE to place the grid control
>> in the window and then using the code editor go into the Into or 
>> General section and type the EGW_AddColumn calls yourself.  That way 
>> you'd be able to set the underlying column.

> OK, I didn't realise I could put EuGrid controls there. I'll
> experiment with that.

Which works fine. I'm now using IDE to build the grid *and* the 
columns, and modifying them as required in the General section.

I'm now cookin' with EuGrid, which is great ... I had started to build 
an editor for my data myself, and this has removed much work for me.

Thanks for your help Jonas.

-- 
Craig

new topic     » goto parent     » topic index » view message » categorize

7. Re: Using EUGrid in IDE

Craig Welch wrote:
> Which works fine. I'm now using IDE to build the grid *and* the 
> columns, and modifying them as required in the General section.
> 
> I'm now cookin' with EuGrid, which is great ... I had started to build 
> an editor for my data myself, and this has removed much work for me.
> 
> Thanks for your help Jonas.
> 
> -- 
> Craig

Not a problem, that's why we're here!

To be honest, I have an EuGrid in almost every program I wrote.  If I
didn't have that control I don't know what the alternatives would be.  Well,
it would probably be me working on my grid control that I stopped working
on when EuGrid came out!

Jonas

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu