Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Loading in combobox

Author
Message
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 17th Mar 2014 21:27
Hey community!

Can anyone explain how can i get the files from a folder and read them in a combobox from BlueGui? or Listbox and then to load them in the scene after clicking?

Thank You very much!

Alex Matei CEO
www.alexmatei.com
Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 17th Mar 2014 23:14 Edited at: 18th Mar 2014 23:45
Wide question...
I'll try to give some very basic clues


1. Populate a listbox with files




2. detecting a selection




3.Load a file

Here's an exemple with objects:

Dont load an object directly but setup internal data:



This struct remembers the filename so that if the screen is lost, objects can be reloaded more easyly.


4.Windowed Mode(Bonus topic)
I made a snippet a while ago about using windowed mode and blueGUI
http://forum.thegamecreators.com/?m=forum_view&t=193293&b=6&msg=2303764#m2303764

!

MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 18th Mar 2014 23:19
Thank you very much for the response!

I tried to replace the message with load object or AddEditorObject(FileName$) or RestoreEditorObject(EditorObject) but it gives me an error of an array that does not exist. I am assuming that Filename$ is the "filename" that load object needs to collect in order to load the object.


Thank you again!

Alex Matei CEO
www.alexmatei.com
Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 18th Mar 2014 23:47 Edited at: 19th Mar 2014 00:08
I forgot array index in RestoreEditorObject()
Load Object EditorObjects(EditorObject).FileName$, EditorObjects(EditorObject).Object

Improving code:


Also use GetItemText() to get the filename in the list..

Reserve Free Object() command is part of matrix1 DLLs

MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 20th Mar 2014 11:09
Sorry Le Vardier i tried to load with load object from the If clickListBox
SI = SelectedItem(ListBox) node and didn't worked and i tried also in this node with AddEditorObject(FileName$) and even RestoreEditorObject(EditorObject)

Thank You for your time!

Alex Matei CEO
www.alexmatei.com
Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 20th Mar 2014 14:47
Did you got a particular error message?
It is not easy to see what is wrong, as I say it was just
some basic pieces of code, but it depends on how they're integrated...

But if you're interested, I can setup a thread on how to make a 3D Editor, step by step..(According my time..)
It'll be very basic: Load objects, place them, load and apply textures, handle camera, save scene...
Just a basis to add more advanced features...

MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 20th Mar 2014 15:41
Hey Le Verdier...yes if you really can do this please do it! You will help me very much! I already have placing objects etc...i don't have the save scene i am running in problems now, i can handle textures in my engine, loading object yes but not handling multiple cameras just 2...the editor and the compile or test mode . I can handle now sounds and cutscenes, constructing levels by primitives, cubes,cones,spheres,plains,cylinders,texturing them, moving them,importing objects,with lights i have some problems of deleting them(multiple) and move them,placing the player etc...i know that i am missing some things so some advice will be so welcomed! Also i can put you on credits if you agree.

And here is the code and the message

Here i put the code load the object but i think its wrong first i put load object "Filename$",1 and then this

If clickListBox
SI = SelectedItem(ListBox)
AddEditorObject(FileName$)
`Message Str$(SI)
EndIf


The error is this:
Array does not exist or array subscript out of bounds at line...

Alex Matei CEO
www.alexmatei.com
Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 20th Mar 2014 17:07
Try:



I can but as I said, il will be very basic..now your editor seem quite progressed..
I'll start this soon

MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 20th Mar 2014 19:21
You can be as you want No problem, really. I know that my engine is pretty advanced but i don't have tipically necessary mechanics such as save the map and after making the map to load it into the "GAME" executable to read the saved file with all the assets and in that "GAME" executable to have the player with the movement etc.


On the other side of listbox problem...i get an error that says:

Parameter for 'ItemText' do not match 'handle gadget, int index' at line 42.

Thank You Again!

Alex Matei CEO
www.alexmatei.com
Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 20th Mar 2014 19:36 Edited at: 20th Mar 2014 19:37
I forgot the half of the parameters
FileName$ = ItemText(ListBox, SelectedItem(ListBox))


MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 20th Mar 2014 20:26
Another runtime error higlited on this code:

EditorObjects().FileName$ = FileName$


Runtime Error 118 - Array does not exist or array subscript out of bounds at line 62

No problems that you are forgeting some lines,no problem, i am really apreciating your help

Alex Matei CEO
www.alexmatei.com
Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 20th Mar 2014 21:13 Edited at: 20th Mar 2014 21:26
Not easy to see what's wrong..
When omiting the array index, EditorObjects().FileName$ , the last valid index is referenced

Try:


MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 20th Mar 2014 21:28
Well i tried also to modify it but no result oh anyway


Could not determine parameter type of '(EditorObjects(0)) EditorObjects(EditorObject).FileName$' at line 62.

To:
EditorObject = array count(EditorObjects(0)) EditorObjects(EditorObject).FileName$ = FileName$

Alex Matei CEO
www.alexmatei.com
Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 20th Mar 2014 22:55 Edited at: 20th Mar 2014 22:55
I lack of idea...
There's something I miss

MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 20th Mar 2014 22:59
Ok then, no problem Looking forward for that basic example I will look on the forum for the first threads to see if it exists depends on when you start

Thank You Again! Good to see people that really wants to help! And also no problem if you missed something here!

Alex Matei CEO
www.alexmatei.com

Login to post a reply

Server time is: 2026-07-07 03:47:18
Your offset time is: 2026-07-07 03:47:18