Author Topic: CSED - Modification  (Read 31155 times)

0 Members and 1 Guest are viewing this topic.

Offline Paul Squires

  • Jr. Member
  • **
  • Posts: 90
  • User-Rate: +11/-5
    • PlanetSquires
Re: CSED - Modification
« Reply #15 on: October 18, 2013, 03:29:20 PM »
This works with FireFly Visual Designer and JellyFish Pro Editor as well. Press F6 while caret positioned over function name to take you to that function. Press Shift+F6 to return back.
Paul Squires
FireFly Visual Designer SQLitening Database System JellyFish Pro Editor
http://www.planetsquires.com

Offline Gary Beene

  • Jr. Member
  • **
  • Posts: 96
  • User-Rate: +3/-0
Re: CSED - Modification
« Reply #16 on: October 18, 2013, 04:36:47 PM »
Hey Paul!
Thanks for the suggestion ...
Quote
Instead of highlighting the text...
I'd though of that, but sometimes in my apps I have functions like MyTasks and MyTask, where the first calls the second repeatedly. So I wanted the option to highlight only the MyTask part of MyTasks.  Not exactly a strong case for highlighting, but it was the thought that drove my approach.

But, you bring up a perspective I wasn't thinking about - using the keyboard.   Not that I can't use the keyboard to highlight a sequence of strings, but I like the idea of your F6 - simpler to use 'cause there's no highlighting by keyboard required.

Offline Gary Beene

  • Jr. Member
  • **
  • Posts: 96
  • User-Rate: +3/-0
Re: CSED - Modification
« Reply #17 on: October 18, 2013, 05:20:50 PM »
Where is the code that changes the caption of the CSED main window, when a new file is opened?

I search for $CSEDVERSION, $CSEDCAPTION, and even the [ symbol. 

I found AfxSetWIndowText used on the TABs, but not on the main window caption.

Nor do I see it in the CSED_OpenFile procedure.

I even made a temp file containing every include/bas file in CSED, searching that way instead of guessing which include might have contained the right code.

Would someone point me in the right direction?  And please, don't let it be really obvious!  :)

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: CSED - Modification
« Reply #18 on: October 18, 2013, 05:55:29 PM »
Be patient. You're new to MDI. The caption that is changed is not the caption of the main window, but the caption of the MDI window. You must be running the editor with the option to maximize MDI child windows activated and you're only seeing the tabs. See the capture below and you will see that the caption of the main window only has CSED and the version number and that each MDI window has as the caption the path of the loaded file.

The captions of the MDI child windows are changed in a couple of places: one in the CSED_OpenFile function of CSED_FILE.INC. This function first checks if the file is already loaded by enumerating the MDI child windows; if it is not, it calls the CSED_CreateMdiChild function, that creates a new MDI child window using the path of the file as the caption. Another place is in the CSED_SaveFile funcion, where it uses IF hMdi THEN AfxSetWindowText hMdi, strPath.
« Last Edit: October 18, 2013, 06:15:04 PM by José Roca »

Offline Gary Beene

  • Jr. Member
  • **
  • Posts: 96
  • User-Rate: +3/-0
Re: CSED - Modification
« Reply #19 on: October 18, 2013, 06:04:20 PM »
Thanks Jose,
Quote
You're new to MDI.
Yes, and I'm glad the text assignment was as you described rather than some trivial thing, such as having overlooked a few lines of code.

As you surmised, I did have the child windows maximized.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: CSED - Modification
« Reply #20 on: October 18, 2013, 06:11:04 PM »
The menu has an item called "Window" with several MDI related options, such cascade, tile horizontal, tile vertical and Arrange icons, because MDI windows can be cascaded, tiled or iconized. besides maximized. It also keeps a list of the files loaded.

The tab control is foreign to MDI and only is being used by convenience. But selecting a tab does nothing else that highlight that tab, because it has not child controls,  and send you a message indicating that the user has changed the selection.


Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: CSED - Modification
« Reply #21 on: October 18, 2013, 06:31:17 PM »
If windows are cascaded or tiled, you can select them by clicking in any part of them, e.g. the caption. See a capture with the windows cascaded.

Offline Paul Squires

  • Jr. Member
  • **
  • Posts: 90
  • User-Rate: +11/-5
    • PlanetSquires
Re: CSED - Modification
« Reply #22 on: October 18, 2013, 08:12:04 PM »
I believe the general trend is away from true MDI applications. The introduction of TAB controls to faciliate the switching amongst child windows makes it very easy to deal with multiple document layouts. In my personal experience, I have not had a burning need to create a true MDI application for over 10 years. I find that SDI applications and TAB'd child forms are much easier to implement and maintain. Of course, there will always be those situations where MDI is better (and I would argue only marginally), but for the vast majority of time you can get by without it.
Paul Squires
FireFly Visual Designer SQLitening Database System JellyFish Pro Editor
http://www.planetsquires.com

Offline Gary Beene

  • Jr. Member
  • **
  • Posts: 96
  • User-Rate: +3/-0
Re: CSED - Modification
« Reply #23 on: October 18, 2013, 08:36:29 PM »
Jose,
A trivial question on a couple of lines of code I saw in CSED ...

Why did you do this (create an extra variable) ...
Code: [Select]
   Local hwndClient As Dword
   hwndClient = pWindow.CreateMDIWindow(101, 0, 0, 0, 0, -1, -1, hWindowMenu, CodePtr(CSED_MDIWindowProc))
   pSed.hwndClient = hwndClient

Instead of this:
Code: [Select]
   pSed.hwndClient = pWindow.CreateMDIWindow(101, 0, 0, 0, 0, -1, -1, hWindowMenu, CodePtr(CSED_MDIWindowProc))

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: CSED - Modification
« Reply #24 on: October 18, 2013, 09:46:35 PM »
It's hard to remember. As I said, one of the main purposes for which I wrote this editor was to test the beta versions of the compiler, and my headers and clases, with non trivial code. Of course, the beta versions of the compiler had bugs that this application helped me to discover. Probably, when I wrote these lines, there was a bug that didn't allowed to do the assignment directly, and later I forgot to change it. As you can see, the code uses many of the new features of PB 10, such classes, unicode, collections, linked lists... Many times I had to use workarounds until the bug was fixed.
« Last Edit: October 18, 2013, 09:50:41 PM by José Roca »

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: CSED - Modification
« Reply #25 on: October 18, 2013, 09:58:01 PM »
I also used #IF DEFs to test that it worked either using ANSI or UNICODE. Currently, all my applications are unicode only.

Offline Gary Beene

  • Jr. Member
  • **
  • Posts: 96
  • User-Rate: +3/-0
Re: CSED - Modification
« Reply #26 on: October 18, 2013, 10:32:05 PM »
Jose,
When I run this short code, taken from your CSED source code files, my modified version of CSED starts alternately highlighting the TAB that is active when the code begins and the last TAB on the right. The program never leaves the loop, freezes up and I have to close the program to stop the flickering.

It seems to be identical to code you've used several times in CSED, but I'm getting unexpected result.

Code: [Select]
   hMDI = GetWindow(pSed.hwndClient, %GW_Child)
   While hMDI
      vPath = AfxGetWindowText(hMdi)                        'get path from the collection
      nTab = CSED_GetTabNumberFromPath(Variant$$(vPath))    'get TAB number from Path
      TabCtrl_SetCurSel(pSed.hTabMdi, nTab)                 'select the TAB
      MDIActivate(pSed.hwndClient, hMdi)                    'activate this MDI child window
      hMDI = GetWindow(hMDI, %GW_HWNDNEXT)
   Wend
Am I doing something obviously wrong?
« Last Edit: October 18, 2013, 10:42:41 PM by Gary Beene »

Offline Gary Beene

  • Jr. Member
  • **
  • Posts: 96
  • User-Rate: +3/-0
Re: CSED - Modification
« Reply #27 on: October 18, 2013, 11:03:01 PM »
Debugging .... I find that if I test the nTab value each loop, it alternates between 0 and 2 (when I have 3 files opened).  Don't know why it's skipping the nTAB=1 value.

The hMDI value likewise alternates between 2 values, not three.
« Last Edit: October 18, 2013, 11:10:00 PM by Gary Beene »

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: CSED - Modification
« Reply #28 on: October 18, 2013, 11:14:13 PM »
I don't understand which is the puporse of that code. After vPath = AfxGetWindowText(hMdi) one should check if it is the window wanted, activate it and leave the loop, e.g.:

Code: [Select]
hMDI = GetWindow(pSed.hwndClient, %GW_Child)
While hMDI
   vPath = AfxGetWindowText(hMdi)                        'get path from the collection
   IF VARIANT$$(vPath) = "<something>" THEN
      nTab = CSED_GetTabNumberFromPath(Variant$$(vPath))    'get TAB number from Path
      TabCtrl_SetCurSel(pSed.hTabMdi, nTab)                 'select the TAB
      MDIActivate(pSed.hwndClient, hMdi)                    'activate this MDI child window
      EXIT DO
   END IF
   hMDI = GetWindow(hMDI, %GW_HWNDNEXT)
Wend
« Last Edit: October 18, 2013, 11:18:55 PM by José Roca »

Offline Gary Beene

  • Jr. Member
  • **
  • Posts: 96
  • User-Rate: +3/-0
Re: CSED - Modification
« Reply #29 on: October 18, 2013, 11:29:05 PM »
Hi Jose, and thanks for responding!

I posted the full function back up in post #9.  That code contains an exit strategy, as you suggest, which is to exit when the scintilla control associated with the TAB has a procedure of a given name.  That code seemed to be working, but is now showing the problem I described.

I pared the post #9 code down to just the few lines above, just to show which code is giving the problem.

The loop, without an exit function strategy, should end on its own. It should walk sequentially through tab numbers 0-2 (when I have 3 files open in CSED). But it does not. It walks repeatedly between tabs 0 and 2 - and I don't see why it is doing that.
« Last Edit: October 18, 2013, 11:31:59 PM by Gary Beene »