- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						Does anyone have experience with setting up a multiple column list box within a dialog box.  I would like to be able to scroll all the rows of the list box with a single scroll bar.
Also, has anyone tried to incorporate an Excel spread sheet into a dialog box? This would be a superior alternative to a multi-column list box since the cells could then contain formulas, etc.
		
		
	
	
	
Also, has anyone tried to incorporate an Excel spread sheet into a dialog box? This would be a superior alternative to a multi-column list box since the cells could then contain formulas, etc.
Link Copied
		14 Replies
	
		
		
			
			
			
					
	
			- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						Tom, I replied to a similar question recently here (re multi-column), but I'm in a hurry now to  -- search for LB_SETTABSTOPS.
Jugoslav
		
		
	
	
	
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						Recently I wrote it by means of width of the column this way:
Select Case (id)
Case (IDC_SPIN_COLUMN)
lret = DlgGet (dlg,IDC_SPIN_COLUMN,Number_of_Column)
Write (Snumber_of_Column,'(I4)') Number_of_Column
lret = DlgSet (dlg,IDC_EDIT_COLUMN,TRIM(ADJUSTL(Snumber_of_Column)))
Case (IDC_EDIT_COLUMN)
lret = DlgGet (dlg,IDC_EDIT_COLUMN,Snumber_of_Column)
Read (Snumber_of_Column,*,Iostat = Iret) Number_of_Column
if (Iret.eq.0) then
Number_of_Column = MIN0(Number_of_Column,11)
Write (Snumber_of_Column,'(I4)') Number_of_Column
lret = DlgSet (dlg,IDC_EDIT_COLUMN,TRIM(ADJUSTL(Snumber_of_Column)))
lret = DlgSet (dlg,IDC_SPIN_COLUMN,Number_of_Column,DLG_POSITION)
end if
end select
	
! Set the Width of Column within ListBox
Width_of_Column = INT4(300 / Number_of_Column)
lret = DlgSendCtrlMessage (Dlg,IDC_LIST_LIST, &
LB_SETCOLUMNWIDTH,Width_of_Column,0)
		
		
	
	
	
Select Case (id)
Case (IDC_SPIN_COLUMN)
lret = DlgGet (dlg,IDC_SPIN_COLUMN,Number_of_Column)
Write (Snumber_of_Column,'(I4)') Number_of_Column
lret = DlgSet (dlg,IDC_EDIT_COLUMN,TRIM(ADJUSTL(Snumber_of_Column)))
Case (IDC_EDIT_COLUMN)
lret = DlgGet (dlg,IDC_EDIT_COLUMN,Snumber_of_Column)
Read (Snumber_of_Column,*,Iostat = Iret) Number_of_Column
if (Iret.eq.0) then
Number_of_Column = MIN0(Number_of_Column,11)
Write (Snumber_of_Column,'(I4)') Number_of_Column
lret = DlgSet (dlg,IDC_EDIT_COLUMN,TRIM(ADJUSTL(Snumber_of_Column)))
lret = DlgSet (dlg,IDC_SPIN_COLUMN,Number_of_Column,DLG_POSITION)
end if
end select
! Set the Width of Column within ListBox
Width_of_Column = INT4(300 / Number_of_Column)
lret = DlgSendCtrlMessage (Dlg,IDC_LIST_LIST, &
LB_SETCOLUMNWIDTH,Width_of_Column,0)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						Let me clarify -- "Multi-column" list boxes (LBS_MULTICOLUMN+LB_SETCOLUMNWIDTH) are not what most people expect. A multi-column list-box just wraps when the bottom is reached, i.e. it looks like File Open dialog in default ("List" mode) and it cannot even have vertical scrollbar. On the other hand, people usually want something like Explorer in "Details" view -- several spreadsheet-like columns with different items in each columns. That can be most closely emulated with LBS_USETABSTOPS+LB_SETTABSTOPS list boxes; not perfect but close.
Jugoslav
		
		
	
	
	
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						Thanks for the help jugoslavdujic.  Have you any experience with actually using an Excel spread sheet in a dialog box?  We do a lot of FE work here and the spread sheet has become a necessary tool for many classes types of modeling.  For instance, it would be nice to have the capability of generating coordinates as a calculated values of the previous rows, etc.
					
				
			
			
				
			
			
			
			
			
			
			
		
		
		
	
	
	
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						No, I don't. You could probably insert it as an ActiveX control, but that's beyond my knowledge. Also, there are bunch of grid controls on the net (see e.g. BabyGrid which is free and has simple API interface) but most don't have spreadsheet functionality -- they just provide grid... and some are quite expen$ive. 
Jugoslav
		
		
	
	
	
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						BabyGrid looks very interesting.  Can anyone provide a sample of how to use it from Fortran?
Thanks,
Gabriel
		
		
	
	
	
Thanks,
Gabriel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						Frankly, I just downloaded it, skimmed over documentation, concluded it might be interesting and "returned it to the shelf". So, I can offer only general guidelines.
In resource editor, insert a "custom control". In its properties, type class name ("BABYGRID"). I don't see any specific styles so the default 0x50010000 (=WS_VISIBLE|WS_CHILD|WS_TABSTOP) should be OK.
Somewhere at your app startup, call RegisterGridClass.
To add rows, columns & items, well, read the documentation. Usually, it will be in form (SendMessage(GetDlgItem(hDlg, IDC_GRID), BGM_XXX, x, y)). The dialog will be most easily handled with Win32 code (DialogBox+DialogProc). It's not so complicated as it may look at the first glance, although it is a bit less elegant than DFLOGM. See e.g. DF98SAMPLESADVANCEDWIN32OWNCOMBOB sample. Probably a BabyGrid could be tweaked into a DFLOGM-handled dialog as well, but you'll end up with the same or bigger amount of code -- you'll have to use SendMessage for all grid handling anyway, and handle BGN_ messages separately.
Jugoslav
		
		
	
	
	
In resource editor, insert a "custom control". In its properties, type class name ("BABYGRID"). I don't see any specific styles so the default 0x50010000 (=WS_VISIBLE|WS_CHILD|WS_TABSTOP) should be OK.
Somewhere at your app startup, call RegisterGridClass.
To add rows, columns & items, well, read the documentation. Usually, it will be in form (SendMessage(GetDlgItem(hDlg, IDC_GRID), BGM_XXX, x, y)). The dialog will be most easily handled with Win32 code (DialogBox+DialogProc). It's not so complicated as it may look at the first glance, although it is a bit less elegant than DFLOGM. See e.g. DF98SAMPLESADVANCEDWIN32OWNCOMBOB sample. Probably a BabyGrid could be tweaked into a DFLOGM-handled dialog as well, but you'll end up with the same or bigger amount of code -- you'll have to use SendMessage for all grid handling anyway, and handle BGN_ messages separately.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						I downloaded the project file for BabyGrid and opened it up in Developer Studio.  The resource editor gives me an error: windows.h not found...  I realize that windows.h is the standard windows header file and I also realize that it is now comprised of several other header files.  Can someone direct me to a copy of windows.h so I can at least open the resource editor for the BabyGrid project.
					
				
			
			
				
			
			
			
			
			
			
			
		
		
		
	
	
	
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						Should be in Program FilesMicrosoft Visual StudioVC98INCLUDE  CVF does supply this, but may not add the VC98INCLUDE folder to the Tools..Options..Directories..Include Files list.
Steve
		
		
	
	
	
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						You'll need BabyGrid.h translated to Fortran anyway. I've spent few minutes to do it for you & test it (just to display it). Attached (I didn't include the .lib so that I don't violate any license agreement).
Jugoslav
		
		
	
	
	
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						P.S. I forgot "use BabyGridTy" within module BabyGrid in BabyGridM.f90. Not essential, but more convenient to use.
					
				
			
			
				
			
			
			
			
			
			
			
		
		
		
	
	
	
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						... you seem to have attached the wrong file.
					
				
			
			
				
			
			
			
			
			
			
			
		
		
		
	
	
	
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						Really? I see... that's very good, because the one I meant to attach was full of s**t :-). Well, here's finally a working version based on last BabyGrid (it's mixed-language so you'll need VC++ to compile it, but you can insert the .lib if you have it).
Jugoslav
		
		
	
	
	
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						Thank jugoslavdujic.  Everything seems to be working now.
 
					
				
			
			
				
			
			
			
			
			
			
			
		
		
		
	
	
	
 
					
				
				
			
		
					
					Reply
					
						
	
		
				
				
				
					
						
					
				
					
				
				
				
				
			
			Topic Options
			
				
					
	
			
		
	- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
